1.0.12 • Published 9 years ago

pipejs v1.0.12

Weekly downloads
76
License
ISC
Repository
github
Last release
9 years ago

PipeJS

PipeEach and Pipe

npm install pipejs

var Pipe = require('pipejs').Pipe;

var PipeEach = require('pipejs').PipeEach;

##Using Pipe

var Pipe = require('pipejs').Pipe;
var hooks = require('./hooks');
var data = {
    field: {
        "title": "Android Widget",
        "name": "watch",
    }
};

var pipeLine = new Pipe();
pipeline.props ={
    customDataToPass:'some data'
};
pipeLine
    .use(hooks.addArray)
    .use(hooks.addSomeText) 
    //OR
    .use(function(err, obj, next, props) {
        // Use 'porps.customDataToPass' in your handlers 
        if (err) {
            console.log(err);
            return;
        }
        obj.field.newField = 'new field added';
        next();
    })
    .run(data)
    .done(function(errors, data, props){
        //errors - Array of errors
        //data - your modified data
        //props - your props (Can be ued for mutated data result or gouping)
    });

##Using PipeEach

var PipeEach = require('pipejs').PipeEach;
var hooks = require('./hooks');
var data = [{
    data: {
        "title": "Android Widget",
        "name": "watch",
    }
}, {
    data: {
        "title": "iPhone Widget",
        "name": "watch",
    }
}];
var iterator = new PipeEach();
pipeline.props ={
    customDataToPass:'some data'
};
iterator
    .use(hooks.addArray)
    .use(hooks.addSomeText) 
    //OR
    .use(function(err, obj, next, props) { 
         // Use 'porps.customDataToPass' in your handlers
        if (err) {
            console.log(err);
            return;
        }
        obj.data.newField = 'new field added';
        next();
    })
    .run(data)
    .done(function(errors, data, props) {
        //errors - Array of errors
        //data - your modified data
        //props - your props (Can be ued for mutated data result or gouping)
        console.log('Errors', errors);
        console.log('Data', data);
    });
    
1.0.12

9 years ago

1.0.11

9 years ago

1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago