{"_id":"pipeworks","_rev":"39-0939a42d86c57dbdcf1337c9ce00629c","name":"pipeworks","description":"Modularize functionality into execution pipelines. Create pipes. Fit 'em together. Start the flow!","dist-tags":{"latest":"1.3.1"},"versions":{"0.0.1":{"name":"pipeworks","version":"0.0.1","description":"Fit functions together for pipelined execution.","main":"pipeworks.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":"","keywords":["event","pipeline","reducer","aggregate"],"author":{"name":"Kevin Swiber","email":"kswiber@gmail.com"},"license":"MIT","_id":"pipeworks@0.0.1","dist":{"shasum":"7c267dfb33afe12dfbdcab7d14442b1675a21134","tarball":"https://registry.npmjs.org/pipeworks/-/pipeworks-0.0.1.tgz","integrity":"sha512-MJjsAfXwLB4dt+awiwMLVXJThspCjk3vR2lyx7O+iZc6hyFa3S/RFy9MOLI0c0A/6ufWKC/z9bHK+HsljIlMzw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC8ALPDeKTRZZqy9I0gN3S1Y+FFLjRbWg0Fqkk6gKBivwIgZHqNcIGbDkEIPqqCSK8lt0TKFAniivwioO7nDgcQE6U="}]},"_from":".","_npmVersion":"1.2.15","_npmUser":{"name":"kevinswiber","email":"kswiber@gmail.com"},"maintainers":[{"name":"kevinswiber","email":"kswiber@gmail.com"}],"directories":{}},"0.0.9":{"name":"pipeworks","version":"0.0.9","description":"Fit functions together for pipelined execution.","main":"pipeworks.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/kevinswiber/pipeworks"},"keywords":["event","pipeline","reducer","aggregate"],"author":{"name":"Kevin Swiber","email":"kswiber@gmail.com"},"license":"MIT","_id":"pipeworks@0.0.9","dist":{"shasum":"968c79fdc155bfea8bfe69ef59c76c82e5e69815","tarball":"https://registry.npmjs.org/pipeworks/-/pipeworks-0.0.9.tgz","integrity":"sha512-BadK6X8L7FrnCpMQ15Avbt59NIrhYQLQBK517JEQ1DzEAOVJVesSVta1TUdE6RBJS31TUIep+oNZc70TKYiSpw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDFr7idyjDEuZwAxgR8ZatnfG2lT+MsR4P2mvrK9YJCKAiAs7zjWLYoAqRuwjtPOq41DcxDIkJbltNo/Z3UJq/OL8A=="}]},"_from":".","_npmVersion":"1.2.15","_npmUser":{"name":"kevinswiber","email":"kswiber@gmail.com"},"maintainers":[{"name":"kevinswiber","email":"kswiber@gmail.com"}],"directories":{}},"1.0.0":{"name":"pipeworks","version":"1.0.0","description":"Modularize functionality into execution pipelines. Create pipes. Fit 'em together. Start the flow!","main":"pipeworks.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"https://github.com/kevinswiber/pipeworks"},"keywords":["execution","pipe","pipeline","reduce","aggregate"],"author":{"name":"Kevin Swiber","email":"kswiber@gmail.com"},"devDependencies":{"mocha":"~1.9.0"},"testling":{"browsers":["ie/6..latest","chrome/20..latest","firefox/10..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6"],"harness":"mocha","files":"test/*.js"},"license":"MIT","_id":"pipeworks@1.0.0","dist":{"shasum":"1a319800db63dbabfdc4692c6dba355975c9d9a2","tarball":"https://registry.npmjs.org/pipeworks/-/pipeworks-1.0.0.tgz","integrity":"sha512-oDvlcTfKMKoZkryGE2QpQ7Mgye1vTXD9K/ChAWLyIqmLsiKllquBoCqf8crUkTf8t9fcYVabwT41R6Un3GxMzg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCpecTT158L7glkGvczN1eUDXpwsOYsNkynGBIGOwNcXwIgTBvHcwhp76emgnwkNOF26IwKrMl6AKHpwlqXUQfVLM8="}]},"_from":".","_npmVersion":"1.2.18","_npmUser":{"name":"kevinswiber","email":"kswiber@gmail.com"},"maintainers":[{"name":"kevinswiber","email":"kswiber@gmail.com"}],"directories":{}},"1.1.0":{"name":"pipeworks","version":"1.1.0","description":"Modularize functionality into execution pipelines. Create pipes. Fit 'em together. Start the flow!","main":"pipeworks.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"https://github.com/kevinswiber/pipeworks"},"keywords":["execution","pipe","pipeline","reduce","aggregate"],"author":{"name":"Kevin Swiber","email":"kswiber@gmail.com"},"devDependencies":{"mocha":"~1.9.0"},"testling":{"browsers":["ie/6..latest","chrome/20..latest","firefox/10..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6"],"harness":"mocha","files":"test/*.js"},"license":"MIT","_id":"pipeworks@1.1.0","dist":{"shasum":"f2d1a6f837cd0cff403f851b4400202f23e6d82a","tarball":"https://registry.npmjs.org/pipeworks/-/pipeworks-1.1.0.tgz","integrity":"sha512-s3W5Ax32ZNHzFLzO5s5dcmGiVWDm86nTT2kuDciSv+AUa+vlPK7utix+y5rsLIkzdTg3qc+UzZbASRIKoQl+ig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH30Cft4t4+oZrFsA+wrJzMZ39WnvQ6VQ4RKY8ZVOedbAiEAvrqg4D0W2gVq3pbPpXDCm8eIdXxTgg2jo3ts6l/OoK8="}]},"_from":".","_npmVersion":"1.2.15","_npmUser":{"name":"kevinswiber","email":"kswiber@gmail.com"},"maintainers":[{"name":"kevinswiber","email":"kswiber@gmail.com"}],"directories":{}},"1.2.0":{"name":"pipeworks","version":"1.2.0","description":"Modularize functionality into execution pipelines. Create pipes. Fit 'em together. Start the flow!","main":"pipeworks.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"https://github.com/kevinswiber/pipeworks"},"keywords":["execution","pipe","pipeline","reduce","aggregate"],"author":{"name":"Kevin Swiber","email":"kswiber@gmail.com"},"devDependencies":{"mocha":"~1.9.0"},"testling":{"browsers":["ie/6..latest","chrome/20..latest","firefox/10..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6"],"harness":"mocha","files":"test/*.js"},"license":"MIT","bugs":{"url":"https://github.com/kevinswiber/pipeworks/issues"},"_id":"pipeworks@1.2.0","dist":{"shasum":"434c3d12ee48f804a1946d2f6bbf0b7929d09041","tarball":"https://registry.npmjs.org/pipeworks/-/pipeworks-1.2.0.tgz","integrity":"sha512-Avu/2Bwg1HgcPnYGylIeHjTwX6YP7kyeSJWx6jJQO5lUMV3w2uCK1LSyK5oCSjs0Bg0xbXkVNsF0xQLNl2T9yw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG4Gn0Xdp9sYMhwSr3KlT8I0xO5tnlXf1Nnqz0aDfnRgAiBdyDuIASmBoEZjy3HJojomla2p6tyZLHO7Z5+FDKITuw=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"kevinswiber","email":"kswiber@gmail.com"},"maintainers":[{"name":"kevinswiber","email":"kswiber@gmail.com"}]},"1.2.1":{"name":"pipeworks","version":"1.2.1","description":"Modularize functionality into execution pipelines. Create pipes. Fit 'em together. Start the flow!","main":"pipeworks.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"https://github.com/kevinswiber/pipeworks"},"keywords":["execution","pipe","pipeline","reduce","aggregate"],"author":{"name":"Kevin Swiber","email":"kswiber@gmail.com"},"devDependencies":{"mocha":"~1.9.0"},"testling":{"browsers":["ie/6..latest","chrome/20..latest","firefox/10..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6"],"harness":"mocha","files":"test/*.js"},"license":"MIT","bugs":{"url":"https://github.com/kevinswiber/pipeworks/issues"},"_id":"pipeworks@1.2.1","dist":{"shasum":"5aad229ec68bacfa08c6c0367722dbbd7152624f","tarball":"https://registry.npmjs.org/pipeworks/-/pipeworks-1.2.1.tgz","integrity":"sha512-1WQofXZtF50pwEoFnomJnSFjtpH2SsR4sABUSsLldx/+E7ZdVaax2lOm2/+n4TG3WZ/zD9xi9junuElSe4sWLg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDde5DvlTIamXwCVskOttxemjx35jYEhVIV4IaEqC161AIhAOPxJ5GzJo3AKjzLHnGEirIu+CHIH95+MWcjZLlKS6an"}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"kevinswiber","email":"kswiber@gmail.com"},"maintainers":[{"name":"kevinswiber","email":"kswiber@gmail.com"}]},"1.3.0":{"name":"pipeworks","version":"1.3.0","description":"Modularize functionality into execution pipelines. Create pipes. Fit 'em together. Start the flow!","main":"pipeworks.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"https://github.com/kevinswiber/pipeworks"},"keywords":["execution","pipe","pipeline","reduce","aggregate"],"author":{"name":"Kevin Swiber","email":"kswiber@gmail.com"},"devDependencies":{"mocha":"~1.9.0"},"testling":{"browsers":["ie/6..latest","chrome/20..latest","firefox/10..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6"],"harness":"mocha","files":"test/*.js"},"license":"MIT","gitHead":"0866675dd76763fe1f861843fb7290f7e70c5fed","bugs":{"url":"https://github.com/kevinswiber/pipeworks/issues"},"homepage":"https://github.com/kevinswiber/pipeworks","_id":"pipeworks@1.3.0","_shasum":"4c48f46e214dd2941278352a840639d09558498c","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"kevinswiber","email":"kswiber@gmail.com"},"maintainers":[{"name":"kevinswiber","email":"kswiber@gmail.com"}],"dist":{"shasum":"4c48f46e214dd2941278352a840639d09558498c","tarball":"https://registry.npmjs.org/pipeworks/-/pipeworks-1.3.0.tgz","integrity":"sha512-s1MddB3QGSZaj1WBXkeppYKXVJUukioEqa29NuTzDwe/b70hVR1+amB7NAvIlkDQFBEpkeHrcey8oy8fbh+RSg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID5IW1/IeQMl3JW6/Se5ZURBLG13ESmMmuStYhOjCi+2AiAB8GMpizQLLqaOTXJHX+CwHHDfZ+Uga/1Lb58hiYjZdw=="}]}},"1.3.1":{"name":"pipeworks","version":"1.3.1","description":"Modularize functionality into execution pipelines. Create pipes. Fit 'em together. Start the flow!","main":"pipeworks.js","scripts":{"test":"mocha -R spec"},"repository":{"type":"git","url":"git+https://github.com/kevinswiber/pipeworks.git"},"keywords":["execution","pipe","pipeline","reduce","aggregate"],"author":{"name":"Kevin Swiber","email":"kswiber@gmail.com"},"devDependencies":{"mocha":"~1.9.0"},"testling":{"browsers":["ie/6..latest","chrome/20..latest","firefox/10..latest","safari/latest","opera/11.0..latest","iphone/6","ipad/6"],"harness":"mocha","files":"test/*.js"},"license":"MIT","gitHead":"b14537483071ce100c9566780199ce317f6426c9","bugs":{"url":"https://github.com/kevinswiber/pipeworks/issues"},"homepage":"https://github.com/kevinswiber/pipeworks#readme","_id":"pipeworks@1.3.1","_shasum":"f8436f8565ed1d97bf3a80632a5397bfd353385f","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.0","_npmUser":{"name":"kevinswiber","email":"kswiber@gmail.com"},"maintainers":[{"name":"kevinswiber","email":"kswiber@gmail.com"}],"dist":{"shasum":"f8436f8565ed1d97bf3a80632a5397bfd353385f","tarball":"https://registry.npmjs.org/pipeworks/-/pipeworks-1.3.1.tgz","integrity":"sha512-uYpoo8eO3GG37tTsPmYoM3rHOxjXd57zMr/4RwiPYyb3RyZj02rfO14D8ERFbrpuYBJCzDwPYmT23a7N3N3Cow==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDBCKEQgiuoE/+FRUMtwSILhf+huz7rlKu9Qj7zzm1I2wIgPa0ufch76jNY7kMh+GuIQBGoGEEhdj+r+v2ChVX/CLg="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pipeworks-1.3.1.tgz_1474321223092_0.7275040301028639"}}},"readme":"# pipeworks \n\nCreate pipes.  Fit 'em together.  Start the flow!\n\nWith *pipeworks*, you can:\n\n- Fit components into execution pipelines.\n- Siphon the flow into branches during execution.\n- Join multiple pipelines together.\n- Intercept errors during execution.\n\n[![Build Status](https://travis-ci.org/kevinswiber/pipeworks.png)](https://travis-ci.org/kevinswiber/pipeworks)\n\n<!-- Testling has not been working lately. :(\n[![browser support](http://ci.testling.com/kevinswiber/pipeworks.png)](http://ci.testling.com/kevinswiber/pipeworks)\n-->\n\n## Example\n\n```javascript\nvar pipeworks = require('pipeworks');\n\npipeworks()\n  .fit(function(context, next) {\n    next(context.replace(/hot dogs/, 'tofu rolls'));\n  })\n  .fit(function(context, next) {\n    next(context.replace(/o/g, '0')\n      .replace(/e/g, '3')\n      .replace(/a/g, '4')\n      .replace(/l/g, '1')\n      .replace(/!/, '!!11~!11!')\n      .toUpperCase());\n  })\n  .fit(function(context, next) {\n    console.log(context);\n    next(context);\n  })\n  .flow('i bet i could eat more hot dogs than anyone!');\n\n// Output:\n// I B3T I C0U1D 34T M0R3 T0FU R011S TH4N 4NY0N3!!11~!11!\n```\n\n## Install\n\n```bash\n$ npm install pipeworks\n```\n\n## Usage\n\n### initialize\n\nStart by initializing a pipeline.\n\n```javascript\nvar pipeworks = require('pipeworks');\n\nvar pipeline = pipeworks();\n```\n\n### pipes\n\nPipes are the modular component of pipeworks.  Fit pipes together to form a pipeline.\n\nThey have the following signature: `function([arguments], next)`.  Pipes can take any number of arguments you wish to pass.  However, it's common to use a single `context` variable as a record to pass state between steps in the execution pipeline.  The last parameter passed to a pipe is a reference to the next function in the pipeline.  Pipes should always end with a call to `next([arguments])`.\n\nSee below.\n\n```javascript\nvar pipe = function(context, next) {\n  context.scores = [25.0, 17.0, 14.7];\n  next(context);\n};\n```\n\n### pipeline.fit([options], pipe)\n\nAdd a pipe to the pipeline.\n\n`options.affinity` - Either `hoist` or `sink`. Adds to the pre and post queues, respectively. Ensures a pipe gets fitted before or after the main execution pipeline.\n\nThe effect of setting the pipeline affinity to `'hoist'`:\n\n```javascript\npipeworks()\n  .fit(function(context, next) {\n    console.log('Cal Naughton, Jr: Shake and bake!');\n    next(context);\n  })\n  .fit({ affinity: 'hoist' }, function(context, next) {\n    console.log('Ricky Bobby: If you ain\\'t first, you\\'re last!');\n    next(context);\n  })\n  .flow({});\n\n// Output:\n// Ricky Bobby: If you ain't first, you're last!\n// Cal Naughton, Jr: Shake and bake!\n```\n\n### pipeline.siphon([arguments], next)\n\nRedirect the flow to another pipeline.\n\n```javascript\nvar hijacker = pipeworks();\nvar main = pipeworks();\n\nhijacker\n  .fit(function(context, next) {\n    context.hijacked = true;\n    console.log('hijacked!');\n    next(context);\n  });\n\nmain\n  .fit(function(context, next) {\n    console.log('getting started');\n    next(context);\n  })\n  .fit(function(context, next) {\n    console.log('am i getting hijacked?');\n    hijacker.siphon(context, next);\n  })\n  .fit(function(context, next) {\n    console.log('done-zo');\n    next(context);\n  });\n\nmain.flow({});\n\n// Output: \n// getting started\n// am i getting hijacked?\n// hijacked!\n// done-zo\n```\n\n### pipeline.join(pipeline)\n\nLink pipelines together.\n\n```javascript\nvar first = pipeworks();\nvar second = pipeworks();\nvar third = pipeworks();\n\nfirst\n  .fit(function(context, next) {\n    console.log('alpha');\n    next(context);\n  })\n  .fit(function(context, next) {\n    console.log('atlanta');\n    next(context);\n  });\n\nsecond\n  .fit(function(context, next) {\n    console.log('beta');\n    next(context);\n  })\n  .fit(function(context, next) {\n    console.log('boise');\n    next(context);\n  });\n\nthird\n  .fit(function(context, next) {\n    console.log('gamma');\n    next(context);\n  })\n  .fit(function(context, next) {\n    console.log('georgetown');\n    next(context);\n  });\n\nfirst.join(second).join(third).flow({});\n\n// Output:\n// alpha\n// atlanta\n// beta\n// boise\n// gamma\n// georgetown\n```\n\n### pipeline.flow([arguments])\n\nSend something down the pipeline!  Any number of arguments can be sent, but often there's just a single `context` object.\n\n```javascript\npipeworks()\n  .fit(function(context, next) {\n    context.age = 30;\n    next(context);\n  })\n  .fit(function(context, next) {\n    console.log(context);\n    next(context);\n  })\n  .flow({ name: 'Kevin' });\n\n// Output:\n// { name: 'Kevin', age: 30 }\n```\n\n### pipeline.fault(callback)\n\nHandle errors during pipeline execution. Using `pipeline.fault` allows access to the current execution context when errors occur in \nthe pipeline.\n\n\n* `callback` -  has the signature `function([arguments], error, next)`\n  *  `[arguments]` - the list of arguments sent to the currently executing pipe\n  * `error` is what was thrown\n  * `next` is a reference to the following pipe in the pipeline.  The `next` argument, in most cases, should not be called.\n\nNote: It's advisable to exit the process after an uncaught exception.  Exceptions leave your application in an unknown state. \nThis method uses [domains](http://nodejs.org/api/domain.html) under the hood.\n\n```javascript\nvar breakfast = pipeworks()\n  .fit(function(context, next) {\n    process.nextTick(function() {\n      if (context.flavor !== 'cinnamon') {\n        throw new Error('These waffles are not *jazzy*!');\n      }\n    }); // simulate async I/O operation\n  })\n  .fit(function(context, next) {\n    console.log('Thanks for breakfast!'); // never reached\n  });\n\nbreakfast.fault(function(context, error) {\n  console.log('Flavor on error:', context.flavor);\n  console.log(error.stack);\n  process.exit(); // the safe play\n});\n\nbreakfast.flow({ flavor: 'plain' })\n```\n\nUsage Notes: Joined pipelines should be treated as new pipelines.  Use fault on the joined pipeline itself for reliability. It is possible to have different fault handlers for each pipeline when using siphon. \n\nEnjoy!\n\n## License\n\nMIT\n","maintainers":[{"name":"kevinswiber","email":"kswiber@gmail.com"}],"time":{"modified":"2022-06-24T00:46:23.805Z","created":"2013-04-14T18:26:45.232Z","0.0.1":"2013-04-14T18:26:46.402Z","0.0.9":"2013-04-15T01:33:23.613Z","1.0.0":"2013-04-15T20:25:19.840Z","1.1.0":"2013-04-17T15:19:58.640Z","1.2.0":"2013-08-28T17:38:27.650Z","1.2.1":"2013-10-10T15:14:02.868Z","1.3.0":"2015-03-13T20:13:26.212Z","1.3.1":"2016-09-19T21:40:26.257Z"},"author":{"name":"Kevin Swiber","email":"kswiber@gmail.com"},"repository":{"type":"git","url":"git+https://github.com/kevinswiber/pipeworks.git"},"homepage":"https://github.com/kevinswiber/pipeworks#readme","keywords":["execution","pipe","pipeline","reduce","aggregate"],"bugs":{"url":"https://github.com/kevinswiber/pipeworks/issues"},"license":"MIT","readmeFilename":"README.md","users":{"darthtrevino":true}}