{"_id":"p-chores","_rev":"4-aa77f968b55461da7da6a24e10de80e8","name":"p-chores","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"p-chores","version":"0.1.0","description":"String together your potentially promise-returning functions into a chain of responsibility. (The fallback pattern trying all strategies one after the other until one of them solves the task.)","keywords":["promise","chain","chain of responsibility","fallback"],"author":{"name":"M.K.","url":"https://github.com/mk-pmb"},"homepage":"https://github.com/mk-pmb/p-chores/#readme","repository":{"type":"git","url":"git+https://github.com/mk-pmb/p-chores.git"},"bugs":{"url":"https://github.com/mk-pmb/p-chores/issues"},"contributors":[],"private":false,"license":"ISC","main":"cor.js","scripts":{"test":"nodejs test/all.node.js"},"directories":{"test":"test"},"dependencies":{},"devDependencies":{"bluebird":"^2.3.11","esmod-pmb":"^0.1.5","p-tape":"^3.0.0"},"npm vs. BOM = Unexpected token":"-*- coding: UTF-8 -*-","gitHead":"6b089497c2acac03527195444a56076e77467324","_id":"p-chores@0.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.2","_npmUser":{"name":"mk-pmb","email":"mk+npmjs@pimpmybyte.de"},"dist":{"integrity":"sha512-LOlA5AfDoBm9pJx/0Nzmb5lzS0cncElgLSprTVz87XacSC8CP3sGM3kjruex4BEPNDjd9rEqHs3sQAHWLHUcUg==","shasum":"4fb061e4a26553b629051eedb2b234fdb145d42b","tarball":"https://registry.npmjs.org/p-chores/-/p-chores-0.1.0.tgz","fileCount":6,"unpackedSize":7589,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbDVSeCRA9TVsSAnZWagAAlDAP/AzdgW0FsVXfo2bBoqsg\nQKOpvOVK55+HKQEQwLq0SQ7hX0JGh8GYvJ5/d+kVG09IkQrcIbkgbW7zzW+A\n2hMTLeuyP3aYQL1h0OUleCOIH6ofLTE6DG3Tz/wvuQPUQV2B5kUxH7IXMdda\nw6coI87ALnpeDxSnZJpKm8EShnN+kN2uHHFaoTSJ9kEmapzlk59UFUR2kRw+\nKApAy0pXKxoacEI4mVH8pgP0yLn0DsnYd4HpE5GVoNxboa6adaRSw4B+rOt4\nJH3E9q/tIXJRvdsQc+cJzqBa1z6ahSBcgeENnzaPaFLjA1p0YCqr7SucvTOd\ngUe54JVtd9Y29yNSSgyFZXfUZuISA5Syf7tvqR3Jex+PdraNEmcAJS7gCe/6\nmNvmIwYn9eTXjXO4H0UnII6JTQJe3qWyU9zdQdG1O4S/nlixcjwEXxCxfL/8\nm3naVfZzl+q4h823mxZ09VHmCpY3rlJIj2DKLr0cNh/llq+WHya1UmdrRwc4\nB5Ccnu7I5SHi2KpmntK3Iqtp9VOAUYukyDrZH6udV7bCRUpNjCiJ4WQ64GsA\naKUYlvYGfv1rJjzTkbYwRt+SP8mG3KFgNJCgmzqFjERMri4pl/os8rj8z6qU\nTlLgdewCWmT+o9CrgrUZNwcNKNaYkRiaNELZDsGJ+ODlOwH9gf0fUrBmT/EF\nWibW\r\n=w+7o\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCpkjZbHOlZVaa8jmFlcPiySr0gZEqRuK5Lr+9xh2EzbAIgG2hrnaiUE5IoC9HxzTBb4VWNeMt+uwHn+JCyanPtnV4="}]},"maintainers":[{"name":"mk-pmb","email":"mk+npmjs@pimpmybyte.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-chores_0.1.0_1527600285406_0.5969132246025746"},"_hasShrinkwrap":false},"0.1.1":{"name":"p-chores","version":"0.1.1","description":"String together your potentially promise-returning functions into a chain of responsibility. (The fallback pattern trying all strategies one after the other until one of them solves the task.)","keywords":["promise","chain","chain of responsibility","fallback"],"author":{"name":"M.K.","url":"https://github.com/mk-pmb"},"homepage":"https://github.com/mk-pmb/p-chores/#readme","repository":{"type":"git","url":"git+https://github.com/mk-pmb/p-chores.git"},"bugs":{"url":"https://github.com/mk-pmb/p-chores/issues"},"contributors":[],"private":false,"license":"ISC","main":"cor.js","scripts":{"test":"nodejs test/all.node.js"},"directories":{"test":"test"},"dependencies":{},"devDependencies":{"bluebird":"^2.3.11","esmod-pmb":"^0.1.5","p-tape":"^3.0.0"},"npm vs. BOM = Unexpected token":"-*- coding: UTF-8 -*-","gitHead":"7fe93fa56209022ffc925179132c9b029933f44c","_id":"p-chores@0.1.1","_npmVersion":"5.6.0","_nodeVersion":"8.11.2","_npmUser":{"name":"mk-pmb","email":"mk+npmjs@pimpmybyte.de"},"dist":{"integrity":"sha512-RPff8u62yka1+uGrCUeB6Ts2NxaYzCoF9m0a6XTdf6p1IZcf3q2JFugVLBFsJ2FkWys84PCNTgOLdPvPi9iZfw==","shasum":"6b02b853bbe24d1ced5e7f7730571f28d05ad945","tarball":"https://registry.npmjs.org/p-chores/-/p-chores-0.1.1.tgz","fileCount":6,"unpackedSize":8015,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbDVp2CRA9TVsSAnZWagAAqCkP/0a6YjEj+EnDkN7nui30\nCec6iGvDHKdP1fvKZ5OCfiOQZdjOj17rzkkNUgpAWDyD8JuPcNfbK57ffZNR\n/+N+hRzTbLTudaZoZ2Yx6XA8VeZj2xW4myvHaNyMIIhEkc5/tlamf/Asm1zK\nOFx1H0skglpof7ZyEk45U6BATP32G1WG+r6AR2uZtWAIMp1boFgyNEiFrFgQ\ntnjfxU9zb2mRaRFb65ToA2QyDYrfnwFF1iSWCK+C+AIgp880kFTLltfXX1/o\nE3b2/UL09rVur9YKoAhycc8SSFkEtJnJZvQFIRlTk3ct18R7cmYLfRofMyQD\neWe+9ZfqqAhREzR1ztvpTDyjDWxoVnehun2aKXRGlxBnmnSuDDO8QLdmqLZK\nzr7sDU6AcYauENKPEcWxvldHwNt5R1IHD3uqTKiQHl6ebUrMUyZB7dCGY5b/\niqMxTm3sPrxaw6Qvbkp/ENZ5sVlQr2rNSMgpJTZbveGmwnLbUG//1jnQDjNq\nI0owcB1OaiSBcmAK/RD3omuDM3lKJwbG4zu5C2MVgDPlfwu04yd4Z4DCAw3v\nD9+RwZRwtrGO/XSjeT66SoWkb4ClRtonb0+fLHTHf8SgbSAu2tiiLtGjFc6n\nvdnQenvdSbGiqTsi6t5DV5YTz/PIOonpAcOMqlh2U7zRJ67Y3CT2g8bRbTuY\nUqyp\r\n=r1Zg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDIMMlSmpN188BFYommgZVMEovFWSvEC+01mHWKCOuH9wIgeAUSw8Vil2+rp9guAd06t/EcVMQueWoe8Sb4F59cVvs="}]},"maintainers":[{"name":"mk-pmb","email":"mk+npmjs@pimpmybyte.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-chores_0.1.1_1527601781325_0.8273931954595699"},"_hasShrinkwrap":false},"0.1.2":{"name":"p-chores","version":"0.1.2","description":"String together your potentially promise-returning functions into a chain of responsibility. (The fallback pattern trying all strategies one after the other until one of them solves the task.)","keywords":["promise","chain","chain of responsibility","fallback"],"author":{"name":"M.K.","url":"https://github.com/mk-pmb"},"homepage":"https://github.com/mk-pmb/p-chores/#readme","repository":{"type":"git","url":"git+https://github.com/mk-pmb/p-chores.git"},"bugs":{"url":"https://github.com/mk-pmb/p-chores/issues"},"contributors":[],"private":false,"license":"ISC","main":"cor.js","scripts":{"test":"nodejs test/all.node.js"},"directories":{"test":"test"},"dependencies":{},"devDependencies":{"bluebird":"^2.3.11","esmod-pmb":"^0.1.5","p-tape":"^3.0.0"},"npm vs. BOM = Unexpected token":"-*- coding: UTF-8 -*-","gitHead":"ae61074ee692f2fee28e8099eedcc3134cea1476","_id":"p-chores@0.1.2","_npmVersion":"5.6.0","_nodeVersion":"8.11.2","_npmUser":{"name":"mk-pmb","email":"mk+npmjs@pimpmybyte.de"},"dist":{"integrity":"sha512-w+dsbNElcRRkPI7TmT9xKwcUSTyRB3T4yK6Sq4Xekg3m1oWqot/PA7BaC7hJWggOqagnXRdXLD0jxDt/jQEWUA==","shasum":"172ef17f48a04ccefa658490a19d7b1bf14299aa","tarball":"https://registry.npmjs.org/p-chores/-/p-chores-0.1.2.tgz","fileCount":6,"unpackedSize":8014,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbDXcwCRA9TVsSAnZWagAA60wP+wedkErPg6NH6SyZlfyC\nW5TpCEvtFUfHwAMZ+frDhizEnOPw1y0WM/4lZROpSk9egp5SC3Ur5FEy1dwp\n8A8/D2cJgawPqJ5qbohbBtT4Zc3yJTZtaS/j9U3qZS1GdDiQGHC9I98XhZSY\nKWyMj5XAC8sgo4ky+KKdwVbGxvMr6Y3KRoXvkgfw7RV5GtpzIQXNnIzOMW+M\nEoCC5HhJPUgf8OEylEWLhW5/mVqednv84jxlVXcd49pru+r05vi9JCEycp8Y\nGJOk63vrVt2z3RfoPbwZCcuVppyux1DrRdQnleVLGwvfRWgxrR7Ft57onSSz\nIteN8S3mIFq1jbKs1jrINVCvNY+GgKtiuVQG+XLRF2OzloV7UC0gx2MJR21n\njN99DsKe6iG+afjwDC4bMEwQDEwkxNaYvjvrU4NuDgOLK44HJiZyZfNcbz90\noW6LryZBJ8lj1Npg0wyJavgx5oueb+cp4AXrFDzIRmAw5b9MVYCerJ7XMJuQ\nTkSFV6yj74wQR6gb4E7x+zdWXTLQ7airuwasCFx/W/3eshFoaQ5DKdVjTu76\nhIUDvb7CApyDZ+ibuh8RyrVbAsf8bmb42szOHp3nSRtafRaasU6u5VnX9ykr\nM/n+s6wN4GA3Loo6+qFCqrJ7szLa5wSzftYXXTtVOJxtAQ2nfKRP6gzbsBRg\n7w3w\r\n=129B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDemTw2fMRvSGcsub6yzB5p5ZS+yUDFo0Z65ugjr7UqIgIgaxYfr0O/rTPopbGMLJZRnGhXK3W8xLQOvkZwHwgoUv0="}]},"maintainers":[{"name":"mk-pmb","email":"mk+npmjs@pimpmybyte.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-chores_0.1.2_1527609136277_0.22881737801753999"},"_hasShrinkwrap":false},"0.1.3":{"name":"p-chores","version":"0.1.3","description":"String together your potentially promise-returning functions into a chain of responsibility. (The fallback pattern trying all strategies one after the other until one of them solves the task.)","keywords":["promise","chain","chain of responsibility","fallback"],"author":{"name":"M.K.","url":"https://github.com/mk-pmb"},"homepage":"https://github.com/mk-pmb/p-chores/#readme","repository":{"type":"git","url":"git+https://github.com/mk-pmb/p-chores.git"},"bugs":{"url":"https://github.com/mk-pmb/p-chores/issues"},"contributors":[],"private":false,"license":"ISC","main":"cor.js","scripts":{"test":"nodejs test/all.node.js"},"directories":{"test":"test"},"dependencies":{},"devDependencies":{"bluebird":"^2.3.11","esmod-pmb":"^0.1.5","p-tape":"^3.0.0"},"npm vs. BOM = Unexpected token":"-*- coding: UTF-8 -*-","gitHead":"1e08d13d876ed775d71ae99bf563342c030541bd","_id":"p-chores@0.1.3","_npmVersion":"5.6.0","_nodeVersion":"8.11.2","_npmUser":{"name":"mk-pmb","email":"mk+npmjs@pimpmybyte.de"},"dist":{"integrity":"sha512-cpVbVPhO7gsRLNvPC+iu4houzn7pAFC1XL2Pdw7/c5PWAXWmI8LAx0cymoqrIR4e2UYBPSjew0pGLffCKCSdaA==","shasum":"8b0ba8aed4a10f17281bd066b518d0d74853c492","tarball":"https://registry.npmjs.org/p-chores/-/p-chores-0.1.3.tgz","fileCount":7,"unpackedSize":8214,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbEeLxCRA9TVsSAnZWagAADGwP/RqcXtBgJmkkfb7/53Fc\nXJNtoNPQjt5HU0NAGzcGg3jRY49yItb5nebGzOx/DjklObvg1KnIz0XOcveM\nKop0L1Tl9hWaOTzcsYDKcq5XuPIdt9yIfpFx5N20pl2/f0+yB7oPI2TDJ/Fi\n3knP7BYha1jDws/hm5R/rY0+iEVbiMtI23XiEvm/7SuOOFi8dpf8nd537rRX\nGdT/lrea5IYB0unwRJzkugOp/NtMUEoxU/KjYufQWQFnuMxUMqkFKzTwVykV\nooIAceGbWFIAtlGcX7Ar8fm81lXWb3Ycbo+wQmHFYBISKHUVX/tECctNlXRi\ndbWMuZOkRAiuPPm4LLR2zNzYYlvzw3+SZtYgnKS7l2BTSZLGu+1fTih0chet\n0k6rlpPSH1rmp/dup0kQi/lryTDPrSVcpqcZO7H6odZkHqRIHPhjbeIlye/H\nHnJ9aV+ip/hXk0sWq3W265hXirO6JG+Rb2RqMAGFahNwOfU8ejA174T7bNL4\niZMrCiRH229izQLpcodljlvJbDMV0YcJbmsbAoC6hZi7hzbHHIHSsU8zzo0m\nccw0TiTjnGE/3nExSQxn3EI0CaE7aAhWymH0TsEpTzgKtp6phs1CI2EkyowP\n2EJRPL55ANDjNIX/+7VskRp7V684P+LSw0KsTc4JSnFn+or5gitKnq/p7c0g\ntNM7\r\n=G4JT\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGs527rrumyAqUmDduLAN1cyfCVVl2PWYVTxwj/WMnnnAiEAyCBlfkKdGdXDKGx3sesEYCTdXIbUJpzxpab73Q5pzb0="}]},"maintainers":[{"name":"mk-pmb","email":"mk+npmjs@pimpmybyte.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-chores_0.1.3_1527898864088_0.11990541425614465"},"_hasShrinkwrap":false}},"time":{"created":"2018-05-29T13:24:45.405Z","0.1.0":"2018-05-29T13:24:45.488Z","modified":"2022-05-12T10:27:23.306Z","0.1.1":"2018-05-29T13:49:41.400Z","0.1.2":"2018-05-29T15:52:16.326Z","0.1.3":"2018-06-02T00:21:04.173Z"},"maintainers":[{"name":"mk-pmb","email":"mk+npmjs@pimpmybyte.de"}],"description":"String together your potentially promise-returning functions into a chain of responsibility. (The fallback pattern trying all strategies one after the other until one of them solves the task.)","homepage":"https://github.com/mk-pmb/p-chores/#readme","keywords":["promise","chain","chain of responsibility","fallback"],"repository":{"type":"git","url":"git+https://github.com/mk-pmb/p-chores.git"},"contributors":[],"author":{"name":"M.K.","url":"https://github.com/mk-pmb"},"bugs":{"url":"https://github.com/mk-pmb/p-chores/issues"},"license":"ISC","readme":"﻿\n<!--#echo json=\"package.json\" key=\"name\" underline=\"=\" -->\np-chores\n========\n<!--/#echo -->\n\n<!--#echo json=\"package.json\" key=\"description\" -->\nString together your potentially promise-returning functions into a chain of\nresponsibility. (The fallback pattern trying all strategies one after the\nother until one of them solves the task.)\n<!--/#echo -->\n\nI rolled my own because I was too impatient waiting for\n[promisefallback](https://github.com/softonic/promisefallback/)\nto merge my pull requests.\n\n\nUsage\n-----\n\nsee [test/usage.mjs](test/usage.mjs)\n\n\nAPI\n---\n\nThis module exports one function:\n\n### promiseChainOfResponsibility([strategies[, opt]])\n\nReturns a function. Let's call that one `cor`.\n\n`opt` is an optional options object which supports these keys:\n  * `accept`: A function that synchronously decides whether its first\n    argument is a valid solution. Its return values is considered boolean.\n    Defaults to the internal `nonEmpty` function which accepts anything\n    except `null`  and `undefined`.\n  * `unsolved`: Which value to use as the (non-)solution when none of the\n    strategies gave an `accept`able solution.\n    The value for `unsolved` won't be checked for its `accept`ability.\n\nWhen you run `cor`, it returns a promise for the solution.\nThe solution is determined by `strategies`, which should be array-like.\nEach strategy can be a function, a Promise, or any other value.\nStrategies are probed one after the other until one succeeds,\ni.e. yields an acceptable result,\ndetermined by these steps (conceptually):\n\n1. Let `pot` (potential solution) be the strategy itself.\n    * If there is no strategy left, solve with `opt.unsolved`.\n1. If your now current `pot` is a function,\n    invoke it with the same context and arguments as `cor` was invoked,\n    and use its result as your new `pot`.\n1. If your now current `pot` is a then-able,\n    defer until it's resolved,\n    then use the resolution value as your new `pot`.\n1. Call `opt.accept` with your current `pot` as the first argument.\n    * In case of a `true`-y result, solve with `pot`.\n    * Otherwise, try the next strategy.\n\n\n\n\n\n\n\n<!--#toc stop=\"scan\" -->\n\n\n\nKnown issues\n------------\n\n* Needs more/better tests and docs.\n\n\n\n\n&nbsp;\n\n\nLicense\n-------\n<!--#echo json=\"package.json\" key=\".license\" -->\nISC\n<!--/#echo -->\n","readmeFilename":"README.md"}