Code coverage report for .readme/includes/Chain/ChainExample.js

Statements: 100% (7 / 7)      Branches: 100% (0 / 0)      Functions: 100% (3 / 3)      Lines: 100% (7 / 7)      Ignored: none     

All files » .readme/includes/Chain/ » ChainExample.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42  1     1         2       1             1                           1         1    
 
var Chain = Divhide.Chain;
 
 
var Maths = new Chain(
 
    /// the chaining fns
    {
        sum: function(i,j){
            return i + j;
        },
 
        sub: function(i, j){
            return i - j;
        }
    },
 
    /// the evaluation fns
    {
        calculate: function(result, err){
            return result;
        }
    },
 
    /// the options
    {
 
        /// if true the return of a function is passed as an argument to the next one
        /// if false, the evaluation arguments are passed to every chain function (default)
        pipe: true
 
    });
 
 
var value = Maths.sum(5)
    .sub(3)
    .sum(10)
    .calculate(0);
 
expect(value)
    .toBe(12);