You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

41 lines
3.1 KiB

{
"name": "async-some",
"version": "1.0.2",
"description": "short-circuited, asynchronous version of Array.protototype.some",
"main": "some.js",
"scripts": {
"test": "tap test/*.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/othiym23/async-some.git"
},
"keywords": [
"async",
"some",
"array",
"collections",
"fp"
],
"author": {
"name": "Forrest L Norvell",
"email": "ogd@aoaioxxysz.net"
},
"license": "ISC",
"bugs": {
"url": "https://github.com/othiym23/async-some/issues"
},
"homepage": "https://github.com/othiym23/async-some",
"dependencies": {
"dezalgo": "^1.0.2"
},
"devDependencies": {
"tap": "^1.1.0"
},
"readme": "# some\n\nShort-circuited async Array.prototype.some implementation.\n\nSerially evaluates a list of values from a JS array or arraylike\nagainst an asynchronous predicate, terminating on the first truthy\nvalue. If the predicate encounters an error, pass it to the completion\ncallback. Otherwise, pass the truthy value passed by the predicate, or\n`false` if no truthy value was passed.\n\nIs\n[Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony)-proof,\nbrowser-safe, and pretty efficient.\n\n## Usage\n\n```javascript\nvar some = require(\"async-some\");\nvar resolve = require(\"path\").resolve;\nvar stat = require(\"fs\").stat;\nvar readFileSync = require(\"fs\").readFileSync;\n\nsome([\"apple\", \"seaweed\", \"ham\", \"quince\"], porkDetector, function (error, match) {\n if (error) return console.error(error);\n\n if (match) return console.dir(JSON.parse(readFileSync(match)));\n\n console.error(\"time to buy more Sporkle™!\");\n});\n\nvar PREFIX = resolve(__dirname, \"../pork_store\");\nfunction porkDetector(value, cb) {\n var path = resolve(PREFIX, value + \".json\");\n stat(path, function (er, stat) {\n if (er) {\n if (er.code === \"ENOENT\") return cb(null, false);\n\n return cb(er);\n }\n\n cb(er, path);\n });\n}\n```\n\n### some(list, test, callback)\n\n* `list` {Object} An arraylike (either an Array or the arguments arraylike) to\n be checked.\n* `test` {Function} The predicate against which the elements of `list` will be\n tested. Takes two parameters:\n * `element` {any} The element of the list to be tested.\n * `callback` {Function} The continuation to be called once the test is\n complete. Takes (again) two values:\n * `error` {Error} Any errors that the predicate encountered.\n * `value` {any} A truthy value. A non-falsy result terminates checking the\n entire list.\n* `callback` {Function} The callback to invoke when either a value has been\n found or the entire input list has been processed with no result. Is invoked\n with the traditional two parameters:\n * `error` {Error} Errors that were encountered during the evaluation of some().\n * `match` {any} Value successfully matched by `test`, if any.\n",
"readmeFilename": "README.md",
"gitHead": "3a5086ad54739c48b2bbf073f23bcc95658199e3",
"_id": "async-some@1.0.2",
"_shasum": "4d8a81620d5958791b5b98f802d3207776e95509",
"_from": "async-some@>=1.0.2 <1.1.0"
}