{"_id":"something-something","_rev":"6-41c0dc148271780950bd7f334bf4990c","name":"something-something","description":"a little asynchronous functional programming library.","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"something-something","version":"0.0.1","description":"a little asynchronous functional programming library.","author":{"name":"Andrew Couch","email":"something-something@andrewcou.ch"},"repository":{"type":"git","url":"https://github.com/couchand/something-something"},"license":"MIT","keywords":["async","asynchronous","functional","collection","map","reduce","filter"],"main":"index.js","scripts":{"test":"mocha"},"devDependencies":{"chai":"~1.9.1","coffee-script":"~1.7.1","mocha":"~1.20.1"},"bugs":{"url":"https://github.com/couchand/something-something/issues"},"_id":"something-something@0.0.1","dist":{"shasum":"0a1a4f4e5e59c181b2241ad8d90bf9ff320db238","tarball":"https://registry.npmjs.org/something-something/-/something-something-0.0.1.tgz","integrity":"sha512-2VLhV6SriHzP9cfUEIg9BDTxCQRiqwFrPWHbydMGu4s6EGvZkbdYKu/lgq9Ilif0bijHKqP50YzRFC4jJr27pg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBiDVIVDrHkeYuLl2NhThGtr6RQ/xHARVh3+Rqu/phIsAiEA6x1uIuxFE4qikJGqPVBBYqB6w59lvrc3sOBTAXO1jJc="}]},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"couchand","email":"npm@couchand.com"},"maintainers":[{"name":"couchand","email":"npm@couchand.com"}]}},"readme":"something something\n===================\n\n*go crazy?  don't mind if i do...*\n\na little asynchronous functional programming library.\n\n  * [why?](#why)\n  * [how?](#how)\n  * [what?](#what)\n\nwhy?\n----\n\nThere are plenty of collections libraries out there (think\n[underscore][0], [lodash][1], etc) and plenty of asynchronous ones\n([async][2] comes to mind), but none of them seem to support\nasynchronous mapping over plain old JavaScript objects.  So I wrote\nthis for that use-case, and while I was at it generalized it to\nhandle both objects and arrays.\n\nhow?\n----\n\nUse the package manager of your choice to install.  We support\n\n```sh\n# npm\nnpm install --save something-something\n\n# component\ncomponent install couchand/something-something\n\n# bower\nbower install something-something\n```\n\nRequire it in your project and start asynchronizing.\n\n```coffeescript\n__ = require 'something-something'\n\ndouble = (value, cb) -> cb null, value * 2\nba_s = (key, value, cb) -> cb null, /ba./.test key\n\noriginal =\n  foo: 1\n  bar: 2\n  baz: 3\n\n__.map original, double, (error, doubled) ->\n  __.filter doubled, ba_s, (error, result) ->\n    assert Object.keys(result).length is 2\n    assert result.bar is 4\n    assert result.baz is 6\n```\n\nSimple, right?\n\nwhat?\n-----\n\nThe standard functional collections methods are here.\n\n  * [map](#map)\n  * [filter](#filter)\n  * [any](#any)\n  * [all](#all)\n  * [what, no reduce?](#what-no-reduce)\n\nAll methods work equally well for arrays and objects.\n\n### map ###\n\n```\n__.map(collection, iterator, [complete])\n\ncollection = Array\n           | Object\niterator   = (value, cb) -> result\n           | (key, value, cb) -> result\n           | (key, value, collection, cb) -> result\ncomplete   = (error, results) ->\n```\n\nStandard `map` function, known in some circles as `collect`.  The\niterator function is called for each element in the collection.  Its\nbehavior is guessed from the airity of the function, so don't try any\nfancy business with `arguments` here.\n\nThe complete callback is called with the `results` collection once\nevery iteration is complete.  If any iteration callsback with an error\nthe map immediately fails, calling back with that error.\n\n### filter ###\n\n```\n__.filter(collection, predicate, [complete])\n\ncollection = Array\n           | Object\npredicate  = (value, cb) -> Boolean\n           | (key, value, cb) -> Boolean\n           | (key, value, collection, cb) -> Boolean\ncomplete   = (error, results) ->\n```\n\nStandard `filter` function, also known as `select`.  The predicate\nis called for each element in the collection.  Again its behavior is\nassumed based on the airity.  The result is coerced to a Boolean.\n\nThe complete callback is called with the filtered `results` once\nevery predicate is complete.  If any predicate callsback with an error\nthe filter immediately fails, calling back with that error.\n\n### any ###\n\n```\n__.any(collection, predicate, [complete])\n\ncollection = Array\n           | Object\npredicate  = (value, cb) -> Boolean\n           | (key, value, cb) -> Boolean\n           | (key, value, collection, cb) -> Boolean\ncomplete   = (error, result) ->\n```\n\nShort-circuiting boolean or (aka `some`).  Callsback `true` as soon as\nany of the predicates callsback `true`.  Callsback `false` if every\npredicate callsback `false`.\n\nCallsback with an error if any predicate callsback in error before one\ncallsback `true`.  This means it swallows some errors and not others,\nwhich may not be desirable.\n\n### all ###\n\n```\ncollection = Array\n           | Object\npredicate  = (value, cb) -> Boolean\n           | (key, value, cb) -> Boolean\n           | (key, value, collection, cb) -> Boolean\ncomplete   = (error, result) ->\n```\n\nShort-circuiting boolean and (aka `every`).  Callsback `false` as soon\nas a single predicate callsback `false`.  Callsback `true` if every\npredicate callsback `true`.\n\nCallsback with an error if any predicate callsback in error before one\ncallsback `false`.  This means it swallows some errors and not others,\nwhich may not be desirable.\n\n### what, no reduce? ###\n\nThis library is about eagerly evaluating a sequence of asynchronous\ncallbacks massively parallel.  Reduce is by nature a series algorithm.\nIf you think there's a good way to write reduce in the same style as\nthe other methods please do submit a pull request.\n\n##### ╭╮☲☲☲╭╮ #####\n\n[0]: http://underscorejs.org\n[1]: http://lodash.com\n[2]: https://github.com/caolan/async\n","maintainers":[{"name":"couchand","email":"npm@couchand.com"}],"time":{"modified":"2022-06-26T22:11:21.045Z","created":"2014-07-14T13:00:36.154Z","0.0.1":"2014-07-14T13:00:37.598Z"},"readmeFilename":"README.markdown","keywords":["async","asynchronous","functional","collection","map","reduce","filter"],"repository":{"type":"git","url":"https://github.com/couchand/something-something"},"author":{"name":"Andrew Couch","email":"something-something@andrewcou.ch"},"bugs":{"url":"https://github.com/couchand/something-something/issues"},"license":"MIT"}