Template Upload
This commit is contained in:
2
node_modules/after/.npmignore
generated
vendored
Normal file
2
node_modules/after/.npmignore
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
.monitor
|
5
node_modules/after/.travis.yml
generated
vendored
Normal file
5
node_modules/after/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 0.6
|
||||
- 0.8
|
||||
- 0.9
|
19
node_modules/after/LICENCE
generated
vendored
Normal file
19
node_modules/after/LICENCE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2011 Raynos.
|
||||
|
||||
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.
|
75
node_modules/after/README.md
generated
vendored
Normal file
75
node_modules/after/README.md
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
# After [![Build Status][1]][2]
|
||||
|
||||
Invoke callback after n calls
|
||||
|
||||
## Status: production ready
|
||||
|
||||
## Example
|
||||
|
||||
var after = require("after")
|
||||
, next = after(3, logItWorks)
|
||||
|
||||
next()
|
||||
next()
|
||||
next() // it works
|
||||
|
||||
function logItWorks() {
|
||||
console.log("it works!")
|
||||
}
|
||||
|
||||
## Example with error handling
|
||||
|
||||
var after = require("after")
|
||||
, next = after(3, logError)
|
||||
|
||||
next()
|
||||
next(new Error("oops")) // logs oops
|
||||
next() // does nothing
|
||||
|
||||
function logError(err) {
|
||||
console.log(err)
|
||||
}
|
||||
|
||||
## After < 0.6.0
|
||||
|
||||
Older versions of after had iterators and flows in them.
|
||||
|
||||
These have been replaced with seperate modules
|
||||
|
||||
- [iterators][8]
|
||||
- [composite][9]
|
||||
|
||||
## Installation
|
||||
|
||||
`npm install after`
|
||||
|
||||
## Tests
|
||||
|
||||
`npm test`
|
||||
|
||||
## Blog post
|
||||
|
||||
- [Flow control in node.js][3]
|
||||
|
||||
## Examples :
|
||||
|
||||
- [Determining the end of asynchronous operations][4]
|
||||
- [In javascript what are best practices for executing multiple asynchronous functions][5]
|
||||
- [JavaScript performance long running tasks][6]
|
||||
- [Synchronous database queries with node.js][7]
|
||||
|
||||
## Contributors
|
||||
|
||||
- Raynos
|
||||
|
||||
## MIT Licenced
|
||||
|
||||
[1]: https://secure.travis-ci.org/Raynos/after.png
|
||||
[2]: http://travis-ci.org/Raynos/after
|
||||
[3]: http://raynos.org/blog/2/Flow-control-in-node.js
|
||||
[4]: http://stackoverflow.com/questions/6852059/determining-the-end-of-asynchronous-operations-javascript/6852307#6852307
|
||||
[5]: http://stackoverflow.com/questions/6869872/in-javascript-what-are-best-practices-for-executing-multiple-asynchronous-functi/6870031#6870031
|
||||
[6]: http://stackoverflow.com/questions/6864397/javascript-performance-long-running-tasks/6889419#6889419
|
||||
[7]: http://stackoverflow.com/questions/6597493/synchronous-database-queries-with-node-js/6620091#6620091
|
||||
[8]: http://github.com/Raynos/iterators
|
||||
[9]: http://github.com/Raynos/composite
|
28
node_modules/after/index.js
generated
vendored
Normal file
28
node_modules/after/index.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
module.exports = after
|
||||
|
||||
function after(count, callback, err_cb) {
|
||||
var bail = false
|
||||
err_cb = err_cb || noop
|
||||
proxy.count = count
|
||||
|
||||
return (count === 0) ? callback() : proxy
|
||||
|
||||
function proxy(err, result) {
|
||||
if (proxy.count <= 0) {
|
||||
throw new Error('after called too many times')
|
||||
}
|
||||
--proxy.count
|
||||
|
||||
// after first error, rest are passed to err_cb
|
||||
if (err) {
|
||||
bail = true
|
||||
callback(err)
|
||||
// future error callbacks will go to error handler
|
||||
callback = err_cb
|
||||
} else if (proxy.count === 0 && !bail) {
|
||||
callback(null, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function noop() {}
|
86
node_modules/after/package.json
generated
vendored
Normal file
86
node_modules/after/package.json
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"after@0.8.1",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\engine.io-parser"
|
||||
]
|
||||
],
|
||||
"_from": "after@0.8.1",
|
||||
"_id": "after@0.8.1",
|
||||
"_inCache": true,
|
||||
"_location": "/after",
|
||||
"_npmUser": {
|
||||
"email": "raynos2@gmail.com",
|
||||
"name": "raynos"
|
||||
},
|
||||
"_npmVersion": "1.2.25",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "after",
|
||||
"raw": "after@0.8.1",
|
||||
"rawSpec": "0.8.1",
|
||||
"scope": null,
|
||||
"spec": "0.8.1",
|
||||
"type": "version"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/engine.io-parser"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/after/-/after-0.8.1.tgz",
|
||||
"_shasum": "ab5d4fb883f596816d3515f8f791c0af486dd627",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "after@0.8.1",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\engine.io-parser",
|
||||
"author": {
|
||||
"email": "raynos2@gmail.com",
|
||||
"name": "Raynos"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/Raynos/after/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Raynos",
|
||||
"email": "raynos2@gmail.com",
|
||||
"url": "http://raynos.org"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "after - tiny flow control",
|
||||
"devDependencies": {
|
||||
"mocha": "~1.8.1"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "ab5d4fb883f596816d3515f8f791c0af486dd627",
|
||||
"tarball": "https://registry.npmjs.org/after/-/after-0.8.1.tgz"
|
||||
},
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"after",
|
||||
"arch",
|
||||
"control",
|
||||
"flow",
|
||||
"flowcontrol"
|
||||
],
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "raynos",
|
||||
"email": "raynos2@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "shtylman",
|
||||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "after",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/Raynos/after.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --ui tdd --reporter spec test/*.js"
|
||||
},
|
||||
"version": "0.8.1"
|
||||
}
|
120
node_modules/after/test/after-test.js
generated
vendored
Normal file
120
node_modules/after/test/after-test.js
generated
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
/*global suite, test*/
|
||||
|
||||
var assert = require("assert")
|
||||
, after = require("../")
|
||||
|
||||
test("exists", function () {
|
||||
assert(typeof after === "function", "after is not a function")
|
||||
})
|
||||
|
||||
test("after when called with 0 invokes", function (done) {
|
||||
after(0, done)
|
||||
});
|
||||
|
||||
test("after 1", function (done) {
|
||||
var next = after(1, done)
|
||||
next()
|
||||
})
|
||||
|
||||
test("after 5", function (done) {
|
||||
var next = after(5, done)
|
||||
, i = 5
|
||||
|
||||
while (i--) {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
test("manipulate count", function (done) {
|
||||
var next = after(1, done)
|
||||
, i = 5
|
||||
|
||||
next.count = i
|
||||
while (i--) {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
test("after terminates on error", function (done) {
|
||||
var next = after(2, function(err) {
|
||||
assert.equal(err.message, 'test');
|
||||
done();
|
||||
})
|
||||
next(new Error('test'))
|
||||
next(new Error('test2'))
|
||||
})
|
||||
|
||||
test('gee', function(done) {
|
||||
done = after(2, done)
|
||||
|
||||
function cb(err) {
|
||||
assert.equal(err.message, 1);
|
||||
done()
|
||||
}
|
||||
|
||||
var next = after(3, cb, function(err) {
|
||||
assert.equal(err.message, 2)
|
||||
done()
|
||||
});
|
||||
|
||||
next()
|
||||
next(new Error(1))
|
||||
next(new Error(2))
|
||||
})
|
||||
|
||||
test('eee', function(done) {
|
||||
done = after(3, done)
|
||||
|
||||
function cb(err) {
|
||||
assert.equal(err.message, 1);
|
||||
done()
|
||||
}
|
||||
|
||||
var next = after(3, cb, function(err) {
|
||||
assert.equal(err.message, 2)
|
||||
done()
|
||||
});
|
||||
|
||||
next(new Error(1))
|
||||
next(new Error(2))
|
||||
next(new Error(2))
|
||||
})
|
||||
|
||||
test('gge', function(done) {
|
||||
function cb(err) {
|
||||
assert.equal(err.message, 1);
|
||||
done()
|
||||
}
|
||||
|
||||
var next = after(3, cb, function(err) {
|
||||
// should not happen
|
||||
assert.ok(false);
|
||||
});
|
||||
|
||||
next()
|
||||
next()
|
||||
next(new Error(1))
|
||||
})
|
||||
|
||||
test('egg', function(done) {
|
||||
function cb(err) {
|
||||
assert.equal(err.message, 1);
|
||||
done()
|
||||
}
|
||||
|
||||
var next = after(3, cb, function(err) {
|
||||
// should not happen
|
||||
assert.ok(false);
|
||||
});
|
||||
|
||||
next(new Error(1))
|
||||
next()
|
||||
next()
|
||||
})
|
||||
|
||||
test('throws on too many calls', function(done) {
|
||||
var next = after(1, done);
|
||||
next()
|
||||
assert.throws(next, /after called too many times/);
|
||||
});
|
||||
|
Reference in New Issue
Block a user