diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2016-05-19 05:28:57 +0300 |
---|---|---|
committer | Kat Marchán <kzm@sykosomatic.org> | 2016-05-19 12:35:59 +0300 |
commit | 4c4609ea49e77303f9d72af6757620e6b3a9a6a9 (patch) | |
tree | 777f65f431b364b9107d45957777d22548203941 /node_modules/inflight | |
parent | 7a3030d3d44ea2136425f72950ba22e6efd441d9 (diff) |
inflight@1.0.5
Diffstat (limited to 'node_modules/inflight')
-rw-r--r-- | node_modules/inflight/package.json | 121 | ||||
-rw-r--r-- | node_modules/inflight/test.js | 97 |
2 files changed, 99 insertions, 119 deletions
diff --git a/node_modules/inflight/package.json b/node_modules/inflight/package.json index 48b4c0e16..e8ff95617 100644 --- a/node_modules/inflight/package.json +++ b/node_modules/inflight/package.json @@ -1,36 +1,113 @@ { - "name": "inflight", - "version": "1.0.4", - "description": "Add callbacks to requests in flight to avoid async duplication", - "main": "inflight.js", - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" + "_args": [ + [ + { + "name": "inflight", + "raw": "inflight@latest", + "rawSpec": "latest", + "scope": null, + "spec": "latest", + "type": "tag" + }, + "/Users/zkat/Documents/code/npm" + ] + ], + "_from": "inflight@latest", + "_id": "inflight@1.0.5", + "_inCache": true, + "_installable": true, + "_location": "/inflight", + "_nodeVersion": "5.10.1", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/inflight-1.0.5.tgz_1463529611443_0.00041943578980863094" }, - "devDependencies": { - "tap": "^0.4.10" + "_npmUser": { + "email": "kat@sykosomatic.org", + "name": "zkat" }, - "scripts": { - "test": "tap test.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/inflight.git" + "_npmVersion": "3.9.1", + "_phantomChildren": {}, + "_requested": { + "name": "inflight", + "raw": "inflight@latest", + "rawSpec": "latest", + "scope": null, + "spec": "latest", + "type": "tag" }, + "_requiredBy": [ + "/", + "/glob", + "/init-package-json/glob", + "/node-gyp/glob", + "/read-package-json/glob", + "/standard/eslint/glob", + "/standard/standard-engine/deglob/glob", + "/tap/nyc/glob", + "/tap/nyc/istanbul/fileset/glob", + "/tap/tap-mocha-reporter/glob" + ], + "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz", + "_shasum": "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a", + "_shrinkwrap": null, + "_spec": "inflight@latest", + "_where": "/Users/zkat/Documents/code/npm", "author": { - "name": "Isaac Z. Schlueter", "email": "i@izs.me", + "name": "Isaac Z. Schlueter", "url": "http://blog.izs.me/" }, "bugs": { "url": "https://github.com/isaacs/inflight/issues" }, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + }, + "description": "Add callbacks to requests in flight to avoid async duplication", + "devDependencies": { + "tap": "^1.2.0" + }, + "directories": {}, + "dist": { + "shasum": "db3204cd5a9de2e6cd890b85c6e2f66bcf4f620a", + "tarball": "https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz" + }, + "files": [ + "inflight.js" + ], + "gitHead": "559e37b4f6327fca797fe8d7fe8ed6d9cae08821", "homepage": "https://github.com/isaacs/inflight", "license": "ISC", - "readme": "# inflight\n\nAdd callbacks to requests in flight to avoid async duplication\n\n## USAGE\n\n```javascript\nvar inflight = require('inflight')\n\n// some request that does some stuff\nfunction req(key, callback) {\n // key is any random string. like a url or filename or whatever.\n //\n // will return either a falsey value, indicating that the\n // request for this key is already in flight, or a new callback\n // which when called will call all callbacks passed to inflightk\n // with the same key\n callback = inflight(key, callback)\n\n // If we got a falsey value back, then there's already a req going\n if (!callback) return\n\n // this is where you'd fetch the url or whatever\n // callback is also once()-ified, so it can safely be assigned\n // to multiple events etc. First call wins.\n setTimeout(function() {\n callback(null, key)\n }, 100)\n}\n\n// only assigns a single setTimeout\n// when it dings, all cbs get called\nreq('foo', cb1)\nreq('foo', cb2)\nreq('foo', cb3)\nreq('foo', cb4)\n```\n", - "readmeFilename": "README.md", - "_id": "inflight@1.0.4", - "_shasum": "6cbb4521ebd51ce0ec0a936bfd7657ef7e9b172a", - "_resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz", - "_from": "inflight@>=1.0.4 <1.1.0" + "main": "inflight.js", + "maintainers": [ + { + "email": "me@re-becca.org", + "name": "iarna" + }, + { + "email": "i@izs.me", + "name": "isaacs" + }, + { + "email": "ogd@aoaioxxysz.net", + "name": "othiym23" + }, + { + "email": "kat@sykosomatic.org", + "name": "zkat" + } + ], + "name": "inflight", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+https://github.com/npm/inflight.git" + }, + "scripts": { + "test": "tap test.js" + }, + "version": "1.0.5" } diff --git a/node_modules/inflight/test.js b/node_modules/inflight/test.js deleted file mode 100644 index 2bb75b388..000000000 --- a/node_modules/inflight/test.js +++ /dev/null @@ -1,97 +0,0 @@ -var test = require('tap').test -var inf = require('./inflight.js') - - -function req (key, cb) { - cb = inf(key, cb) - if (cb) setTimeout(function () { - cb(key) - cb(key) - }) - return cb -} - -test('basic', function (t) { - var calleda = false - var a = req('key', function (k) { - t.notOk(calleda) - calleda = true - t.equal(k, 'key') - if (calledb) t.end() - }) - t.ok(a, 'first returned cb function') - - var calledb = false - var b = req('key', function (k) { - t.notOk(calledb) - calledb = true - t.equal(k, 'key') - if (calleda) t.end() - }) - - t.notOk(b, 'second should get falsey inflight response') -}) - -test('timing', function (t) { - var expect = [ - 'method one', - 'start one', - 'end one', - 'two', - 'tick', - 'three' - ] - var i = 0 - - function log (m) { - t.equal(m, expect[i], m + ' === ' + expect[i]) - ++i - if (i === expect.length) - t.end() - } - - function method (name, cb) { - log('method ' + name) - process.nextTick(cb) - } - - var one = inf('foo', function () { - log('start one') - var three = inf('foo', function () { - log('three') - }) - if (three) method('three', three) - log('end one') - }) - - method('one', one) - - var two = inf('foo', function () { - log('two') - }) - if (two) method('one', two) - - process.nextTick(log.bind(null, 'tick')) -}) - -test('parameters', function (t) { - t.plan(8) - - var a = inf('key', function (first, second, third) { - t.equal(first, 1) - t.equal(second, 2) - t.equal(third, 3) - }) - t.ok(a, 'first returned cb function') - - var b = inf('key', function (first, second, third) { - t.equal(first, 1) - t.equal(second, 2) - t.equal(third, 3) - }) - t.notOk(b, 'second should get falsey inflight response') - - setTimeout(function () { - a(1, 2, 3) - }) -}) |