{"_id":"@caiogondim/pipeline","_rev":"10-862d6069fc0e36405615deb53af8f097","name":"@caiogondim/pipeline","description":"Your functional (sync/async) pipe | operator","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.0":{"name":"@caiogondim/pipeline","version":"1.0.0","description":"Function to mimic pipe operator in functional languages","main":"dist/index.js","directories":{"test":"test"},"scripts":{"lint":"standard 'test/**/*.js' 'src/**/*.js'","test":"tap --cov test/*.js","posttest":"tap --coverage-report=lcov | codecov","generate-docs":"node tasks/generate-docs.js"},"repository":{"type":"git","url":"git+https://github.com/caiogondim/pipeline.js.git"},"keywords":["pipeline","pipe","functional"],"author":{"name":"Caio Gondim","email":"me@caiogondim.com","url":"http://caiogondim.com"},"license":"ISC","bugs":{"url":"https://github.com/caiogondim/pipe.js/issues"},"homepage":"https://github.com/caiogondim/pipeline.js#readme","devDependencies":{"codecov":"^1.0.1","marked":"^0.3.6","standard":"^7.1.2","tap":"^7.0.0"},"gitHead":"965920868f91456fd2a887abc958404ac9b17aae","_id":"@caiogondim/pipeline@1.0.0","_shasum":"369dade232d48c6605703e02906645d83dea2082","_from":".","_npmVersion":"3.10.7","_nodeVersion":"6.6.0","_npmUser":{"name":"caiogondim","email":"me@caiogondim.com"},"maintainers":[{"name":"caiogondim","email":"me@caiogondim.com"}],"dist":{"shasum":"369dade232d48c6605703e02906645d83dea2082","tarball":"https://registry.npmjs.org/@caiogondim/pipeline/-/pipeline-1.0.0.tgz","integrity":"sha512-Nnal+v+cmwvQSN8EC3CBbqGCNlZdSu+ARF6xZKfPBTHhiqA25OtMKpltvrRu5kRdGTufjMY0oBBrhIe5sFz6TA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDFixTePWDDyOtnMnWkttoiOXk7uBupuwXpa2pnAar4KgIhAIXH6CfmnQqxNs2yS5fJau9Io84qByxKkG01UyUDrUtL"}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pipeline-1.0.0.tgz_1474581705173_0.48297195974737406"},"deprecated":"This package was renamed to *tubo*"},"1.0.1":{"name":"@caiogondim/pipeline","version":"1.0.1","description":"Function to mimic pipe operator in functional languages","main":"dist/index.js","directories":{"test":"test"},"scripts":{"lint":"standard 'test/**/*.js' 'src/**/*.js'","test":"tap --cov test/*.js","posttest":"tap --coverage-report=lcov | codecov","generate-docs":"node tasks/generate-docs.js"},"repository":{"type":"git","url":"git+https://github.com/caiogondim/pipeline.js.git"},"keywords":["pipeline","pipe","functional"],"author":{"name":"Caio Gondim","email":"me@caiogondim.com","url":"http://caiogondim.com"},"license":"ISC","bugs":{"url":"https://github.com/caiogondim/pipe.js/issues"},"homepage":"https://github.com/caiogondim/pipeline.js#readme","devDependencies":{"codecov":"^1.0.1","marked":"^0.3.6","standard":"^7.1.2","tap":"^7.0.0"},"gitHead":"d22fa462158199e09cb31b03f1b798deda209da6","_id":"@caiogondim/pipeline@1.0.1","_shasum":"3c42014d016bf2c2d2edffcf2a6960dc370db284","_from":".","_npmVersion":"3.10.7","_nodeVersion":"6.6.0","_npmUser":{"name":"caiogondim","email":"me@caiogondim.com"},"maintainers":[{"name":"caiogondim","email":"me@caiogondim.com"}],"dist":{"shasum":"3c42014d016bf2c2d2edffcf2a6960dc370db284","tarball":"https://registry.npmjs.org/@caiogondim/pipeline/-/pipeline-1.0.1.tgz","integrity":"sha512-ioVqUxg3Wo9OE4ceLpiIwAmlBBgY2b/wDzsq3RO9BmUrltbg+niXCTyl0Nr9uTQ1aAu9juZtgDVrHhZR6M9SRA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIACMb0wBATTkMOjK/mwq9gBq7ymc+YpfCEpDyz/2uEQCAiEA3Y3JaqMCdA0NfojWr49ZHhgK54HQ7qSPrDqVvoHrEI0="}]},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pipeline-1.0.1.tgz_1474581858314_0.25534425862133503"},"deprecated":"This package was renamed to *tubo*"},"1.0.2":{"name":"@caiogondim/pipeline","version":"1.0.2","description":"Function to mimic pipe operator in functional languages","main":"dist/index.js","directories":{"test":"test"},"scripts":{"lint":"standard 'test/**/*.js' 'src/**/*.js'","test":"tap --cov test/*.js","posttest":"tap --coverage-report=lcov | codecov","generate-docs":"node tasks/generate-docs.js"},"repository":{"type":"git","url":"git+https://github.com/caiogondim/pipeline.js.git"},"keywords":["pipeline","pipe","functional"],"author":{"name":"Caio Gondim","email":"me@caiogondim.com","url":"http://caiogondim.com"},"license":"ISC","bugs":{"url":"https://github.com/caiogondim/pipe.js/issues"},"homepage":"https://github.com/caiogondim/pipeline.js#readme","devDependencies":{"codecov":"^1.0.1","marked":"^0.3.6","standard":"^7.1.2","tap":"^7.0.0"},"gitHead":"c7904106180c2a5c8cc448921cb2045c95e54ec6","_id":"@caiogondim/pipeline@1.0.2","_shasum":"73b1c983f7c01a6f8f1ced48fb3c977d17d74396","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.6.0","_npmUser":{"name":"caiogondim","email":"me@caiogondim.com"},"maintainers":[{"name":"caiogondim","email":"me@caiogondim.com"}],"dist":{"shasum":"73b1c983f7c01a6f8f1ced48fb3c977d17d74396","tarball":"https://registry.npmjs.org/@caiogondim/pipeline/-/pipeline-1.0.2.tgz","integrity":"sha512-ovjTQJ1uEvQKMHXi2ecwP2d/AOQ1XTqadY/+hz+gsTHNu06FJzU59qUMwibifYN75HCSuB5EBxo9mjHG82q4RA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFTQlgCm35p5rUpSY8XYF7/jRYM0ui0MbAHcOZDJx5j4AiEA46YWMCqr5dyYOEmlotyW1LW/QjvZ5QbRBS4ZfBfdhHk="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pipeline-1.0.2.tgz_1474760650890_0.11639153398573399"},"deprecated":"This package was renamed to *tubo*"},"1.0.3":{"name":"@caiogondim/pipeline","version":"1.0.3","description":"Your functional pipe | operator","main":"dist/index.js","directories":{"test":"test"},"scripts":{"lint":"standard 'test/**/*.js' 'src/**/*.js'","test":"tap --cov test/*.js","posttest":"tap --coverage-report=lcov | codecov","generate-docs":"node tasks/generate-docs.js"},"repository":{"type":"git","url":"git+https://github.com/caiogondim/pipeline.js.git"},"keywords":["pipeline","pipe","functional"],"author":{"name":"Caio Gondim","email":"me@caiogondim.com","url":"http://caiogondim.com"},"license":"ISC","bugs":{"url":"https://github.com/caiogondim/pipe.js/issues"},"homepage":"https://github.com/caiogondim/pipeline.js#readme","devDependencies":{"codecov":"^1.0.1","marked":"^0.3.6","standard":"^7.1.2","tap":"^7.0.0"},"gitHead":"491c3a783bfd7b94bd0908af045a24904d5ac504","_id":"@caiogondim/pipeline@1.0.3","_shasum":"9d6650a22c972f6686bab2402dbaff47016dfd90","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.6.0","_npmUser":{"name":"caiogondim","email":"me@caiogondim.com"},"maintainers":[{"name":"caiogondim","email":"me@caiogondim.com"}],"dist":{"shasum":"9d6650a22c972f6686bab2402dbaff47016dfd90","tarball":"https://registry.npmjs.org/@caiogondim/pipeline/-/pipeline-1.0.3.tgz","integrity":"sha512-/77vh+dND3L16EJ9k7InMsBs2CzP/4N/53EsPalXTe++OB8sEdCzg4LR3r1m1qjssQK1HXiRi00LLruK28ZJsQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAXE/TYP4F3Qi3QBDaY79qfTRJlVUIsCTGzNp5/6va30AiEAkTw72+/GxatXOIcm7zaRchnOzMtqO7unVNXAunwEKI4="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pipeline-1.0.3.tgz_1474760766767_0.9663586562965065"},"deprecated":"This package was renamed to *tubo*"},"1.0.4":{"name":"@caiogondim/pipeline","version":"1.0.4","description":"Your functional (sync/async) pipe | operator","main":"dist/index.js","directories":{"test":"test"},"scripts":{"lint":"standard 'test/**/*.js' 'src/**/*.js'","test":"tap --cov test/*.js","posttest":"tap --coverage-report=lcov | codecov","generate-docs":"node tasks/generate-docs.js"},"repository":{"type":"git","url":"git+https://github.com/caiogondim/pipeline.js.git"},"keywords":["pipeline","pipe","functional"],"author":{"name":"Caio Gondim","email":"me@caiogondim.com","url":"http://caiogondim.com"},"license":"ISC","bugs":{"url":"https://github.com/caiogondim/pipe.js/issues"},"homepage":"https://github.com/caiogondim/pipeline.js#readme","devDependencies":{"codecov":"^1.0.1","marked":"^0.3.6","standard":"^7.1.2","tap":"^7.0.0"},"gitHead":"88af7ca0cdc6162511e25b2074220d20f3abd3de","_id":"@caiogondim/pipeline@1.0.4","_shasum":"ab372694cce5a0b5f996df83090132861396c06a","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.6.0","_npmUser":{"name":"caiogondim","email":"me@caiogondim.com"},"maintainers":[{"name":"caiogondim","email":"me@caiogondim.com"}],"dist":{"shasum":"ab372694cce5a0b5f996df83090132861396c06a","tarball":"https://registry.npmjs.org/@caiogondim/pipeline/-/pipeline-1.0.4.tgz","integrity":"sha512-rS8rgtjwlpTQTKuxcLqW/c8ocHeM3O8DlI84GQzu3nQSWIDWb/n65V+GsgnLRWwLOyNN6pnt36sqEguIonXP+g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDgnHmIWKiBHKvvaMfWX0B6FSMpSomP8hpU14p6FlP4+wIgYx9Voil4hynqaXmgaGmnRweGZOM0IvNlOxhn2yCuw8I="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pipeline-1.0.4.tgz_1474761129493_0.8289013688918203"},"deprecated":"This package was renamed to *tubo*"},"1.0.5":{"name":"@caiogondim/pipeline","version":"1.0.5","description":"Your functional (sync/async) pipe | operator","main":"src/index.js","directories":{"test":"test"},"scripts":{"lint":"standard 'test/**/*.js' 'src/**/*.js'","test":"tap --cov test/*.js","posttest":"tap --coverage-report=lcov | codecov","generate-docs":"node tasks/generate-docs.js"},"repository":{"type":"git","url":"git+https://github.com/caiogondim/pipeline.js.git"},"keywords":["pipeline","pipe","functional"],"author":{"name":"Caio Gondim","email":"me@caiogondim.com","url":"http://caiogondim.com"},"license":"ISC","bugs":{"url":"https://github.com/caiogondim/pipe.js/issues"},"homepage":"https://github.com/caiogondim/pipeline.js#readme","devDependencies":{"codecov":"^1.0.1","marked":"^0.3.6","standard":"^7.1.2","tap":"^7.0.0"},"gitHead":"42f54e13f476fd9a25d1790a8fa61ef885ddb682","_id":"@caiogondim/pipeline@1.0.5","_shasum":"789bbce2f0c7e7f2e0b2a642c94c43a52a4e568e","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"caiogondim","email":"me@caiogondim.com"},"dist":{"shasum":"789bbce2f0c7e7f2e0b2a642c94c43a52a4e568e","tarball":"https://registry.npmjs.org/@caiogondim/pipeline/-/pipeline-1.0.5.tgz","integrity":"sha512-33LG+6XuLlRS5WwfsS8ijASDuyGcxl9gejbD6+4CpwUHlVuReDouSOerptrqMBY0JBJ7Lhxm/OPIxzewmXXF9A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD6oN62cfrhOOLSLXJcHA3mYDj4BnVrSIB29ftn7YEuzwIgFXQRY4ajy6dfggJLZ/4ZYNYZegZkFNZn8sO3BL3QE5A="}]},"maintainers":[{"name":"caiogondim","email":"me@caiogondim.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pipeline-1.0.5.tgz_1476739779750_0.6460454787593335"},"deprecated":"This package was renamed to *tubo*"},"1.0.6":{"name":"@caiogondim/pipeline","version":"1.0.6","description":"Your functional (sync/async) pipe | operator","main":"src/index.js","directories":{"test":"test"},"scripts":{"lint":"standard 'test/**/*.js' 'src/**/*.js'","test":"tap --cov test/*.js","posttest":"tap --coverage-report=lcov | codecov","generate-docs":"node tasks/generate-docs.js"},"repository":{"type":"git","url":"git+https://github.com/caiogondim/pipeline.js.git"},"keywords":["pipeline","pipe","functional"],"author":{"name":"Caio Gondim","email":"me@caiogondim.com","url":"http://caiogondim.com"},"license":"MIT","bugs":{"url":"https://github.com/caiogondim/pipe.js/issues"},"homepage":"https://github.com/caiogondim/pipeline.js#readme","devDependencies":{"codecov":"^1.0.1","marked":"^0.3.6","standard":"^7.1.2","tap":"^7.0.0"},"gitHead":"da30f3a3b3490e46cfe449224c7f910c660a6dea","_id":"@caiogondim/pipeline@1.0.6","_shasum":"bb02234d9a4733df263ce358d025471f25cb4c4c","_from":".","_npmVersion":"3.10.8","_nodeVersion":"6.8.1","_npmUser":{"name":"caiogondim","email":"me@caiogondim.com"},"dist":{"shasum":"bb02234d9a4733df263ce358d025471f25cb4c4c","tarball":"https://registry.npmjs.org/@caiogondim/pipeline/-/pipeline-1.0.6.tgz","integrity":"sha512-sGkA9miPY6PZluN+xggLoPBjSTvt+HvFZsAYWBwSSMp3CkAEJNb+GH+LHR2jAKm2NXOMjj0BUbjSiF75+AQHBw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDXi0hJYeZ57gm7VuAIQSlSqgatiWq9F4+rXCwXCCrArgIgK5hsD2QP841e3FxpycS91DqB+0JaGOGIJ0CHLevXFdo="}]},"maintainers":[{"name":"caiogondim","email":"me@caiogondim.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/pipeline-1.0.6.tgz_1476739939549_0.16167547716759145"},"deprecated":"This package was renamed to *tubo*"}},"readme":"<img src=\"http://rawgit.com/caiogondim/pipeline.js/master/img/icon.svg\">\n\n# pipeline.js\n\n<img src=\"http://travis-ci.org/caiogondim/pipeline.js.svg?branch=master\" alt=\"Travis CI\"> [![codecov](https://codecov.io/gh/caiogondim/obstructed.js/branch/master/graph/badge.svg)](https://codecov.io/gh/caiogondim/obstructed.js)\n\n\nPipeline works like the pipe operator more common in functional programming\nlanguages, like Elixir.\n\nThis lib supports **sync** and **async** arguments.\n\nIf all arguments are sync functions or literal, the pipeline will run as a normal\nfunction returning the last value computed. In case one of the arguments is a\nfunction that returns a promise or a promise instance (then-able object), a\npromise will be returned at the end.\n\n## Usage\n\n### Sync\n\n```js\nfunction double(x) {\n  return x * 2\n}\n\nfunction square(x) {\n  return x * x\n}\n\nvar output = pipeline(\n  2,\n  double,\n  square\n)\nconsole.log(output) // => 16\n```\n\n### Async\n\n```js\npipeline(\n  bookingDetails.userId,\n  fetchUserById, // async\n  JSON.parse\n)\n  .then(function(result) {\n    console.log(result)\n  })\n  .catch(function(error) {\n    console.log(error)\n  })\n```\n\n### Mixed\n\nIt is also possible to mix sync and async arguments.\nWhenever a function that generates promises or a promise intance is found,\nthe lib switchs to async mode and will return a `Promise`.\n\n## Installation\n\nTo use the library, install it through npm\n\n```bash\nnpm install @caiogondim/pipeline --save\n```\n\nTo port it to Browser or any other (non CJS) environment, use your favorite CJS\nbundler. No favorite yet? Try: [Browserify](http://browserify.org/),\n[Webmake](https://github.com/medikoo/modules-webmake) or\n[Webpack](http://webpack.github.io/).\n\n## Examples\n\n### Validation (sync and async)\n\n```js\n// Before\nfunction validateEmail(email) {\n  email = trim(email)\n  validateEmailTld(email)\n  validateEmailFormat(email)\n}\n\n// After\nfunction validateEmail(email) {\n  return pipeline(\n    email,\n    trim,\n    validateEmailTld,\n    validateEmailFormat\n  )\n}\n\ntry {\n  validateEmail('john@email.com')\n} catch (error) {\n  console.log(error)\n}\n```\n\n### Straight-forward Cases\n\n```js\n// Before\nif (cache && localStorage.getItem(endpoint)) {\n  return m.prop( JSON.parse( localStorage.get(endpoint) ) )\n}\n\n// After\nif (cache && localStorage.getItem(endpoint)) {\n  return pipeline(\n    localStorage.get(endpoint),\n    JSON.parse,\n    m.prop\n  )\n}\n```\n\n### Usage with const\n\n```js\n// Before\nlet items = base64ToJSON(response.data.content)\nitems = Array.isArray(items) ? items : [items]\n\n// After\nconst items = pipeline(\n  base64ToJSON(response.data.content),\n  x => Array.isArray(x) ? x : [x]\n)\n```\n\n### Functional Updates\n\n```js\n// Before\nreturn Event.create(\n  Object.assign(attrs, { parent_id: parentId, status: 'draft' })\n)\n\n// After\nreturn pipeline(\n  Object.assign(attrs, { parent_id: parentId, status: 'draft' }),\n  Event.create\n)\n```\n\n## Reference and credits\n- [Ramda.js pipe](http://ramdajs.com/docs/#pipe)\n- [lodash.js flow](https://lodash.com/docs#flow)\n- [pipe.py](https://github.com/JulienPalard/Pipe)\n- Some exampes taken from https://github.com/mindeavor/es-pipeline-operator/wiki/Example-Use-Cases\n\n---\n\n[caiogondim.com](https://caiogondim.com) &nbsp;&middot;&nbsp;\nGitHub [@caiogondim](https://github.com/caiogondim) &nbsp;&middot;&nbsp;\nTwitter [@caio_gondim](https://twitter.com/caio_gondim)\n","maintainers":[{"name":"caiogondim","email":"me@caiogondim.com"}],"time":{"modified":"2022-06-12T15:37:05.241Z","created":"2016-09-22T22:01:46.055Z","1.0.0":"2016-09-22T22:01:46.055Z","1.0.1":"2016-09-22T22:04:20.145Z","1.0.2":"2016-09-24T23:44:12.109Z","1.0.3":"2016-09-24T23:46:08.014Z","1.0.4":"2016-09-24T23:52:10.721Z","1.0.5":"2016-10-17T21:29:41.672Z","1.0.6":"2016-10-17T21:32:21.423Z"},"homepage":"https://github.com/caiogondim/pipeline.js#readme","keywords":["pipeline","pipe","functional"],"repository":{"type":"git","url":"git+https://github.com/caiogondim/pipeline.js.git"},"author":{"name":"Caio Gondim","email":"me@caiogondim.com","url":"http://caiogondim.com"},"bugs":{"url":"https://github.com/caiogondim/pipe.js/issues"},"license":"MIT","readmeFilename":"README.md"}