46 lines
53 KiB
JSON
46 lines
53 KiB
JSON
|
{
|
||
|
"name": "async",
|
||
|
"description": "Higher-order functions and common patterns for asynchronous code",
|
||
|
"main": "./lib/async",
|
||
|
"author": {
|
||
|
"name": "Caolan McMahon"
|
||
|
},
|
||
|
"version": "0.9.0",
|
||
|
"repository": {
|
||
|
"type": "git",
|
||
|
"url": "https://github.com/caolan/async.git"
|
||
|
},
|
||
|
"bugs": {
|
||
|
"url": "https://github.com/caolan/async/issues"
|
||
|
},
|
||
|
"licenses": [
|
||
|
{
|
||
|
"type": "MIT",
|
||
|
"url": "https://github.com/caolan/async/raw/master/LICENSE"
|
||
|
}
|
||
|
],
|
||
|
"devDependencies": {
|
||
|
"nodeunit": ">0.0.0",
|
||
|
"uglify-js": "1.2.x",
|
||
|
"nodelint": ">0.0.0"
|
||
|
},
|
||
|
"jam": {
|
||
|
"main": "lib/async.js",
|
||
|
"include": [
|
||
|
"lib/async.js",
|
||
|
"README.md",
|
||
|
"LICENSE"
|
||
|
]
|
||
|
},
|
||
|
"scripts": {
|
||
|
"test": "nodeunit test/test-async.js"
|
||
|
},
|
||
|
"readme": "# Async.js\n\n[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async)\n\n\nAsync is a utility module which provides straight-forward, powerful functions\nfor working with asynchronous JavaScript. Although originally designed for\nuse with [Node.js](http://nodejs.org), it can also be used directly in the\nbrowser. Also supports [component](https://github.com/component/component).\n\nAsync provides around 20 functions that include the usual 'functional'\nsuspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns\nfor asynchronous control flow (`parallel`, `series`, `waterfall`…). All these\nfunctions assume you follow the Node.js convention of providing a single\ncallback as the last argument of your `async` function.\n\n\n## Quick Examples\n\n```javascript\nasync.map(['file1','file2','file3'], fs.stat, function(err, results){\n // results is now an array of stats for each file\n});\n\nasync.filter(['file1','file2','file3'], fs.exists, function(results){\n // results now equals an array of the existing files\n});\n\nasync.parallel([\n function(){ ... },\n function(){ ... }\n], callback);\n\nasync.series([\n function(){ ... },\n function(){ ... }\n]);\n```\n\nThere are many more functions available so take a look at the docs below for a\nfull list. This module aims to be comprehensive, so if you feel anything is\nmissing please create a GitHub issue for it.\n\n## Common Pitfalls\n\n### Binding a context to an iterator\n\nThis section is really about `bind`, not about `async`. If you are wondering how to\nmake `async` execute your iterators in a given context, or are confused as to why\na method of another library isn't working as an iterator, study this example:\n\n```js\n// Here is a simple object with an (unnecessarily roundabout) squaring method\nvar AsyncSquaringLibrary = {\n squareExponent: 2,\n square: function(number, callback){ \n var result = Math.pow(number, this.squareExponent);\n setTimeout(function(){\n callback(null, result);\n }, 200);\n }\n};\n\nasync.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){\n // result is [NaN, NaN, NaN]\n // This fails because the `this.squareExponent` expression in the square\n // function is not evaluated in the context of AsyncSquaringLibrary, and is\n // therefore undefined.\n});\n\nasync.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){\n // result is [1, 4, 9]\n // With the help of bind we can attach a context to the iterator before\n // passing it to async. Now the square function will be executed in its \n // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent`\n // will be as expected.\n});\n```\n\n## Download\n\nThe source is available for download from\n[GitHub](http://github.com/caolan/async).\nAlternatively, you can install using Node Package Manager (`npm`):\n\n npm install async\n\n__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed\n\n## In the Browser\n\nSo far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. \n\nUsage:\n\n```html\n<script type=\"text/javascript\" src=\"async.js\"></script>\n<script type=\"text/javascript\">\n\n async.map(data, asyncProcess, function(err, results){\n alert(results);\n });\n\n</script>\n```\n\n## Documentation\n\n### Collections\n\n* [`each`](#each)\n* [`eachSeries`](#eachSeries)\n* [`eachLimit`](#eachLimit)\n* [`map`](#map)\n* [`mapSeries`](#mapSeries)\n* [`mapLimit`](#mapLimit)\n* [`filter`](#filter)\n* [`filterSeries`](#filterSeries)\n* [`reject`](#reject)\n* [`rejectSeries`](#rejectSeries)\n* [`reduce`](#reduce)\n* [`reduceRight`](#reduceRight)\n* [`detect`](#detect)\n* [`detectSeries`](#detectSeries)\n* [`sortBy`](#sortBy)\n* [`some`](#some)\n* [`every`](#every)\n* [`concat`](#concat)\n* [`concatSeries`](#concatSeries)\n\n### Control Flow\n\n* [`series`](#seriestasks-callback)\n* [`parallel`](#parallel)\n* [`parallelLimit`](#
|
||
|
"readmeFilename": "README.md",
|
||
|
"homepage": "https://github.com/caolan/async",
|
||
|
"_id": "async@0.9.0",
|
||
|
"_shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7",
|
||
|
"_from": "async@",
|
||
|
"_resolved": "https://registry.npmjs.org/async/-/async-0.9.0.tgz"
|
||
|
}
|