Hello community, here is the log from the commit of package nodejs-inflight for openSUSE:Factory checked in at 2014-10-24 10:47:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nodejs-inflight (Old) and /work/SRC/openSUSE:Factory/.nodejs-inflight.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nodejs-inflight" Changes: -------- --- /work/SRC/openSUSE:Factory/nodejs-inflight/nodejs-inflight.changes 2014-09-23 10:46:20.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.nodejs-inflight.new/nodejs-inflight.changes 2014-10-24 10:47:44.000000000 +0200 @@ -1,0 +2,10 @@ +Fri Oct 10 15:02:35 UTC 2014 - [email protected] + +- update to version 1.0.4 + +------------------------------------------------------------------- +Thu Oct 9 15:08:13 UTC 2014 - [email protected] + +- use nodejs-packaging for building + +------------------------------------------------------------------- Old: ---- inflight-1.0.2.tgz New: ---- inflight-1.0.4.tgz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nodejs-inflight.spec ++++++ --- /var/tmp/diff_new_pack.pQ2dON/_old 2014-10-24 10:47:45.000000000 +0200 +++ /var/tmp/diff_new_pack.pQ2dON/_new 2014-10-24 10:47:45.000000000 +0200 @@ -19,20 +19,19 @@ %define base_name inflight Name: nodejs-inflight -Version: 1.0.2 +Version: 1.0.4 Release: 0 Summary: Node.js inflight License: ISC Group: Development/Languages/Other Url: https://github.com/isaacs/inflight Source: http://registry.npmjs.org/%{base_name}/-/%{base_name}-%{version}.tgz -Requires: nodejs-once -Requires: nodejs-wrappy -BuildRequires: nodejs +BuildRequires: nodejs-packaging BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch ExclusiveArch: %{ix86} x86_64 %{arm} noarch -%{?nodejs_requires} + +%nodejs_find_provides_and_requires %description Add callbacks to requests in flight to avoid async duplication ++++++ inflight-1.0.2.tgz -> inflight-1.0.4.tgz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/.eslintrc new/package/.eslintrc --- old/package/.eslintrc 1970-01-01 01:00:00.000000000 +0100 +++ new/package/.eslintrc 2014-10-03 08:40:51.000000000 +0200 @@ -0,0 +1,17 @@ +{ + "env" : { + "node" : true + }, + "rules" : { + "semi": [2, "never"], + "strict": 0, + "quotes": [1, "single", "avoid-escape"], + "no-use-before-define": 0, + "curly": 0, + "no-underscore-dangle": 0, + "no-lonely-if": 1, + "no-unused-vars": [2, {"vars" : "all", "args" : "after-used"}], + "no-mixed-requires": 0, + "space-infix-ops": 0 + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/inflight.js new/package/inflight.js --- old/package/inflight.js 2014-09-19 01:08:37.000000000 +0200 +++ new/package/inflight.js 2014-10-03 08:47:10.000000000 +0200 @@ -14,12 +14,31 @@ } } -function makeres(key) { - return once(function(error, data) { +function makeres (key) { + return once(function RES () { var cbs = reqs[key] - delete reqs[key] - cbs.forEach(function(cb) { - cb(error, data) - }) + var len = cbs.length + var args = slice(arguments) + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } }) } + +function slice (args) { + var length = args.length + var array = [] + + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/package.json new/package/package.json --- old/package/package.json 2014-09-19 01:09:27.000000000 +0200 +++ new/package/package.json 2014-10-03 08:49:19.000000000 +0200 @@ -1,6 +1,6 @@ { "name": "inflight", - "version": "1.0.2", + "version": "1.0.4", "description": "Add callbacks to requests in flight to avoid async duplication", "main": "inflight.js", "dependencies": { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/package/test.js new/package/test.js --- old/package/test.js 2014-05-05 04:56:11.000000000 +0200 +++ new/package/test.js 2014-10-03 08:46:35.000000000 +0200 @@ -31,3 +31,67 @@ 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) + }) +}) -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
