Template Upload
This commit is contained in:
4
node_modules/batch/.npmignore
generated
vendored
Normal file
4
node_modules/batch/.npmignore
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
*.sock
|
71
node_modules/batch/History.md
generated
vendored
Normal file
71
node_modules/batch/History.md
generated
vendored
Normal file
@ -0,0 +1,71 @@
|
||||
|
||||
0.5.1 / 2014-06-19
|
||||
==================
|
||||
|
||||
* add repository field to readme (exciting)
|
||||
|
||||
0.5.0 / 2013-07-29
|
||||
==================
|
||||
|
||||
* add `.throws(true)` to opt-in to responding with an array of error objects
|
||||
* make `new` optional
|
||||
|
||||
0.4.0 / 2013-06-05
|
||||
==================
|
||||
|
||||
* add catching of immediate callback errors
|
||||
|
||||
0.3.2 / 2013-03-15
|
||||
==================
|
||||
|
||||
* remove Emitter call in constructor
|
||||
|
||||
0.3.1 / 2013-03-13
|
||||
==================
|
||||
|
||||
* add Emitter() mixin for client. Closes #8
|
||||
|
||||
0.3.0 / 2013-03-13
|
||||
==================
|
||||
|
||||
* add component.json
|
||||
* add result example
|
||||
* add .concurrency support
|
||||
* add concurrency example
|
||||
* add parallel example
|
||||
|
||||
0.2.1 / 2012-11-08
|
||||
==================
|
||||
|
||||
* add .start, .end, and .duration properties
|
||||
* change dependencies to devDependencies
|
||||
|
||||
0.2.0 / 2012-10-04
|
||||
==================
|
||||
|
||||
* add progress events. Closes #5 (__BREAKING CHANGE__)
|
||||
|
||||
0.1.1 / 2012-07-03
|
||||
==================
|
||||
|
||||
* change "complete" event to "progress"
|
||||
|
||||
0.1.0 / 2012-07-03
|
||||
==================
|
||||
|
||||
* add Emitter inheritance and emit "complete" [burcu]
|
||||
|
||||
0.0.3 / 2012-06-02
|
||||
==================
|
||||
|
||||
* Callback results should be in the order of the queued functions.
|
||||
|
||||
0.0.2 / 2012-02-12
|
||||
==================
|
||||
|
||||
* any node
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
6
node_modules/batch/Makefile
generated
vendored
Normal file
6
node_modules/batch/Makefile
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
test:
|
||||
@./node_modules/.bin/mocha \
|
||||
--require should
|
||||
|
||||
.PHONY: test
|
74
node_modules/batch/Readme.md
generated
vendored
Normal file
74
node_modules/batch/Readme.md
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
|
||||
# batch
|
||||
|
||||
Simple async batch with concurrency control and progress reporting.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ npm install batch
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var Batch = require('batch')
|
||||
, batch = new Batch;
|
||||
|
||||
batch.concurrency(4);
|
||||
|
||||
ids.forEach(function(id){
|
||||
batch.push(function(done){
|
||||
User.get(id, done);
|
||||
});
|
||||
});
|
||||
|
||||
batch.on('progress', function(e){
|
||||
|
||||
});
|
||||
|
||||
batch.end(function(err, users){
|
||||
|
||||
});
|
||||
```
|
||||
|
||||
### Progress events
|
||||
|
||||
Contain the "job" index, response value, duration information, and completion data.
|
||||
|
||||
```js
|
||||
{ index: 1,
|
||||
value: 'bar',
|
||||
pending: 2,
|
||||
total: 3,
|
||||
complete: 2,
|
||||
percent: 66,
|
||||
start: Thu Oct 04 2012 12:25:53 GMT-0700 (PDT),
|
||||
end: Thu Oct 04 2012 12:25:53 GMT-0700 (PDT),
|
||||
duration: 0 }
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
14
node_modules/batch/component.json
generated
vendored
Normal file
14
node_modules/batch/component.json
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "batch",
|
||||
"repo": "visionmedia/batch",
|
||||
"description": "Async task batching",
|
||||
"version": "0.5.2",
|
||||
"keywords": ["batch", "async", "utility", "concurrency", "concurrent"],
|
||||
"dependencies": {
|
||||
"component/emitter": "*"
|
||||
},
|
||||
"development": {},
|
||||
"scripts": [
|
||||
"index.js"
|
||||
]
|
||||
}
|
158
node_modules/batch/index.js
generated
vendored
Normal file
158
node_modules/batch/index.js
generated
vendored
Normal file
@ -0,0 +1,158 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
try {
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
} catch (err) {
|
||||
var Emitter = require('emitter');
|
||||
}
|
||||
|
||||
/**
|
||||
* Noop.
|
||||
*/
|
||||
|
||||
function noop(){}
|
||||
|
||||
/**
|
||||
* Expose `Batch`.
|
||||
*/
|
||||
|
||||
module.exports = Batch;
|
||||
|
||||
/**
|
||||
* Create a new Batch.
|
||||
*/
|
||||
|
||||
function Batch() {
|
||||
if (!(this instanceof Batch)) return new Batch;
|
||||
this.fns = [];
|
||||
this.concurrency(Infinity);
|
||||
this.throws(true);
|
||||
for (var i = 0, len = arguments.length; i < len; ++i) {
|
||||
this.push(arguments[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Inherit from `EventEmitter.prototype`.
|
||||
*/
|
||||
|
||||
if (EventEmitter) {
|
||||
Batch.prototype.__proto__ = EventEmitter.prototype;
|
||||
} else {
|
||||
Emitter(Batch.prototype);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set concurrency to `n`.
|
||||
*
|
||||
* @param {Number} n
|
||||
* @return {Batch}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Batch.prototype.concurrency = function(n){
|
||||
this.n = n;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Queue a function.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @return {Batch}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Batch.prototype.push = function(fn){
|
||||
this.fns.push(fn);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set wether Batch will or will not throw up.
|
||||
*
|
||||
* @param {Boolean} throws
|
||||
* @return {Batch}
|
||||
* @api public
|
||||
*/
|
||||
Batch.prototype.throws = function(throws) {
|
||||
this.e = !!throws;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Execute all queued functions in parallel,
|
||||
* executing `cb(err, results)`.
|
||||
*
|
||||
* @param {Function} cb
|
||||
* @return {Batch}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Batch.prototype.end = function(cb){
|
||||
var self = this
|
||||
, total = this.fns.length
|
||||
, pending = total
|
||||
, results = []
|
||||
, errors = []
|
||||
, cb = cb || noop
|
||||
, fns = this.fns
|
||||
, max = this.n
|
||||
, throws = this.e
|
||||
, index = 0
|
||||
, done;
|
||||
|
||||
// empty
|
||||
if (!fns.length) return cb(null, results);
|
||||
|
||||
// process
|
||||
function next() {
|
||||
var i = index++;
|
||||
var fn = fns[i];
|
||||
if (!fn) return;
|
||||
var start = new Date;
|
||||
|
||||
try {
|
||||
fn(callback);
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
}
|
||||
|
||||
function callback(err, res){
|
||||
if (done) return;
|
||||
if (err && throws) return done = true, cb(err);
|
||||
var complete = total - pending + 1;
|
||||
var end = new Date;
|
||||
|
||||
results[i] = res;
|
||||
errors[i] = err;
|
||||
|
||||
self.emit('progress', {
|
||||
index: i,
|
||||
value: res,
|
||||
error: err,
|
||||
pending: pending,
|
||||
total: total,
|
||||
complete: complete,
|
||||
percent: complete / total * 100 | 0,
|
||||
start: start,
|
||||
end: end,
|
||||
duration: end - start
|
||||
});
|
||||
|
||||
if (--pending) next();
|
||||
else if(!throws) cb(errors, results);
|
||||
else cb(null, results);
|
||||
}
|
||||
}
|
||||
|
||||
// concurrency
|
||||
for (var i = 0; i < fns.length; i++) {
|
||||
if (i == max) break;
|
||||
next();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
79
node_modules/batch/package.json
generated
vendored
Normal file
79
node_modules/batch/package.json
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"batch@0.5.3",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\serve-index"
|
||||
]
|
||||
],
|
||||
"_from": "batch@0.5.3",
|
||||
"_id": "batch@0.5.3",
|
||||
"_inCache": true,
|
||||
"_location": "/batch",
|
||||
"_nodeVersion": "0.12.4",
|
||||
"_npmUser": {
|
||||
"email": "tj@vision-media.ca",
|
||||
"name": "tjholowaychuk"
|
||||
},
|
||||
"_npmVersion": "2.10.1",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "batch",
|
||||
"raw": "batch@0.5.3",
|
||||
"rawSpec": "0.5.3",
|
||||
"scope": null,
|
||||
"spec": "0.5.3",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/serve-index"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/batch/-/batch-0.5.3.tgz",
|
||||
"_shasum": "3f3414f380321743bfc1042f9a83ff1d5824d464",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "batch@0.5.3",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\serve-index",
|
||||
"author": {
|
||||
"email": "tj@vision-media.ca",
|
||||
"name": "TJ Holowaychuk"
|
||||
},
|
||||
"browser": {
|
||||
"emitter": "events"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/batch/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Simple async batch",
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "3f3414f380321743bfc1042f9a83ff1d5824d464",
|
||||
"tarball": "https://registry.npmjs.org/batch/-/batch-0.5.3.tgz"
|
||||
},
|
||||
"gitHead": "247f3ec041be32bb8ddc0816d2155b2391550084",
|
||||
"homepage": "https://github.com/visionmedia/batch",
|
||||
"installable": true,
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT"
|
||||
}
|
||||
],
|
||||
"main": "index",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
}
|
||||
],
|
||||
"name": "batch",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/visionmedia/batch.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "0.5.3"
|
||||
}
|
Reference in New Issue
Block a user