Comparing version 1.4.0 to 1.4.1
{ | ||
"name": "contra", | ||
"description": "Asynchronous flow control with a functional taste to it", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"homepage": "https://github.com/bevacqua/contra", | ||
@@ -38,3 +38,7 @@ "author": { | ||
], | ||
"dependencies": {} | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"assert": "~0.0.2", | ||
"mocha": "~1.17.1" | ||
} | ||
} |
@@ -9,3 +9,3 @@ (function (Object, root) { | ||
function a (o) { return Object.prototype.toString.call(o) === '[object Array]'; } | ||
function atoa (a) { return Array.prototype.slice.call(a); } | ||
function atoa (a, n) { return Array.prototype.slice.call(a, n); } | ||
function cb (fn, args, ctx) { if (!fn) { return; } tick(function run () { fn.apply(ctx || null, args || []); }); } | ||
@@ -204,3 +204,3 @@ function once (fn) { | ||
load--; | ||
cb(job.done, atoa(arguments).splice(1)); | ||
cb(job.done, atoa(arguments, 1)); | ||
cb(labor); | ||
@@ -207,0 +207,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(n,t){"use strict";function e(t){return"[object Array]"===n.prototype.toString.call(t)}function r(n){return Array.prototype.slice.call(n)}function u(n,t,e){n&&v(function(){n.apply(e||null,t||[])})}function i(n){function t(){e||(e=!0,n.apply(null,arguments))}var e;return t.discard=function(){e=!0},t}function o(n,t,e){var r=n.shift();return r?(e&&e.discard(),u(t,[r]),!0):void 0}function f(){var n=r(arguments),t=n.shift();return function(){var e=r(arguments);t.apply(t,n.concat(e))}}function c(n,t){function e(){var f=i(t);return i(function(){var t=r(arguments),i=n.shift();if(i){if(o(t,f))return;t.push(e()),u(i,t)}else u(f,arguments)})}e()()}function a(t,f,c){function a(n,e){function i(){var t=r(arguments);o(t,s)||(m[n]=t.shift(),e())}u(t[n],[i])}c||(c=f,f=k);var s=i(c),l=h(a,f),p=n.keys(t),m=e(t)?[]:{};l.unshift(p),l.on("drain",function(){s(null,m)})}function s(n,t){a(n,y,t)}function l(t,r){return function(u,i,o,f){2===arguments.length&&(o=i,i=k),3===arguments.length&&"number"!=typeof i&&(f=o,o=i,i=k);var c=n.keys(u),s=e(u)?[]:{};c.forEach(function(n){s[n]=function(t){o(u[n],t)}}),a(s,t||i,r?r(u,f):f)}}function p(n){function t(n,t){return function(n){t(n)}}return l(n,t)}function m(t){function r(t,r){return function(u,i){function o(n,t){return!!i[t]}function f(){var e={};return n.keys(t).forEach(function(n){o(null,n)&&(e[n]=t[n])}),e}return u?void r(u):void r(null,e(i)?t.filter(o):f())}}return l(t,r)}function d(n){var t={};return n.on=function(n,e){t[n]?t[n].push(e):t[n]=[e]},n.once=function(t,e){e._once=!0,n.on(t,e)},n.off=function(n,e){var r=t[n];r&&r.splice(r.indexOf(e),1)},n.emit=function(){var n=r(arguments),e=n.shift(),i=t[e];if("error"===e&&!i)throw 1===n.length?n[0]:n;i&&(t[e]=i.filter(function(t){return u(t,n),!t._once}))},n}function h(t,o){function f(n){var t=n?"unshift":"push";return function(n,r){var i=e(n)?n:[n];i.forEach(function(n){l[t]({t:n,done:r})}),u(c)}}function c(){if(!(s||m!==k&&p>=m)){if(!l.length)return void(0===p&&h.emit("drain"));p++;var n=l.pop();t(n.t,i(a.bind(null,n))),u(c)}}function a(n){p--,u(n.done,r(arguments).splice(1)),u(c)}var s,l=[],p=0,m=o||1,h=d({push:f(!1),unshift:f(!0),pause:function(){s=!0},resume:function(){s=!1,u(c)},pending:l});return n.defineProperty&&!n.definePropertyPartial&&n.defineProperty(h,"length",{get:function(){return l.length}}),h}var v,g="undefined",y=1,k=1/0,x="function"==typeof setImmediate;v=typeof process!==g&&process.nextTick?x?setImmediate:process.nextTick:x?function(n){setImmediate(n)}:function(n){setTimeout(n,0)};var b={curry:f,concurrent:a,series:s,waterfall:c,each:p(),map:l(),filter:m(),queue:h,emitter:d};b.each.series=p(y),b.map.series=l(y),b.filter.series=m(y),typeof module!==g&&module.exports?module.exports=b:t.contra=b}(Object,this); | ||
!function(n,t){"use strict";function e(t){return"[object Array]"===n.prototype.toString.call(t)}function r(n,t){return Array.prototype.slice.call(n,t)}function u(n,t,e){n&&v(function(){n.apply(e||null,t||[])})}function i(n){function t(){e||(e=!0,n.apply(null,arguments))}var e;return t.discard=function(){e=!0},t}function o(n,t,e){var r=n.shift();return r?(e&&e.discard(),u(t,[r]),!0):void 0}function f(){var n=r(arguments),t=n.shift();return function(){var e=r(arguments);t.apply(t,n.concat(e))}}function c(n,t){function e(){var f=i(t);return i(function(){var t=r(arguments),i=n.shift();if(i){if(o(t,f))return;t.push(e()),u(i,t)}else u(f,arguments)})}e()()}function a(t,f,c){function a(n,e){function i(){var t=r(arguments);o(t,s)||(m[n]=t.shift(),e())}u(t[n],[i])}c||(c=f,f=k);var s=i(c),l=h(a,f),p=n.keys(t),m=e(t)?[]:{};l.unshift(p),l.on("drain",function(){s(null,m)})}function s(n,t){a(n,y,t)}function l(t,r){return function(u,i,o,f){2===arguments.length&&(o=i,i=k),3===arguments.length&&"number"!=typeof i&&(f=o,o=i,i=k);var c=n.keys(u),s=e(u)?[]:{};c.forEach(function(n){s[n]=function(t){o(u[n],t)}}),a(s,t||i,r?r(u,f):f)}}function p(n){function t(n,t){return function(n){t(n)}}return l(n,t)}function m(t){function r(t,r){return function(u,i){function o(n,t){return!!i[t]}function f(){var e={};return n.keys(t).forEach(function(n){o(null,n)&&(e[n]=t[n])}),e}return u?void r(u):void r(null,e(i)?t.filter(o):f())}}return l(t,r)}function d(n){var t={};return n.on=function(n,e){t[n]?t[n].push(e):t[n]=[e]},n.once=function(t,e){e._once=!0,n.on(t,e)},n.off=function(n,e){var r=t[n];r&&r.splice(r.indexOf(e),1)},n.emit=function(){var n=r(arguments),e=n.shift(),i=t[e];if("error"===e&&!i)throw 1===n.length?n[0]:n;i&&(t[e]=i.filter(function(t){return u(t,n),!t._once}))},n}function h(t,o){function f(n){var t=n?"unshift":"push";return function(n,r){var i=e(n)?n:[n];i.forEach(function(n){l[t]({t:n,done:r})}),u(c)}}function c(){if(!(s||m!==k&&p>=m)){if(!l.length)return void(0===p&&h.emit("drain"));p++;var n=l.pop();t(n.t,i(a.bind(null,n))),u(c)}}function a(n){p--,u(n.done,r(arguments,1)),u(c)}var s,l=[],p=0,m=o||1,h=d({push:f(!1),unshift:f(!0),pause:function(){s=!0},resume:function(){s=!1,u(c)},pending:l});return n.defineProperty&&!n.definePropertyPartial&&n.defineProperty(h,"length",{get:function(){return l.length}}),h}var v,g="undefined",y=1,k=1/0,x="function"==typeof setImmediate;v=typeof process!==g&&process.nextTick?x?setImmediate:process.nextTick:x?function(n){setImmediate(n)}:function(n){setTimeout(n,0)};var b={curry:f,concurrent:a,series:s,waterfall:c,each:p(),map:l(),filter:m(),queue:h,emitter:d};b.each.series=p(y),b.map.series=l(y),b.filter.series=m(y),typeof module!==g&&module.exports?module.exports=b:t.contra=b}(Object,this); |
{ | ||
"name": "contra", | ||
"description": "Asynchronous flow control with a functional taste to it", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"homepage": "https://github.com/bevacqua/contra", | ||
@@ -27,3 +27,3 @@ "author": { | ||
"scripts": { | ||
"test": "mocha --reporter tap && jshint --reporter node_modules/jshint-tap/jshint-tap.js test/*" | ||
"test": "mocha --reporter tap && jshint --reporter node_modules/jshint-tap/jshint-tap.js test/*.js" | ||
}, | ||
@@ -33,2 +33,3 @@ "testling": { | ||
"files": [ | ||
"src/contra.js", | ||
"src/contra.shim.js", | ||
@@ -35,0 +36,0 @@ "test/*.js" |
122
README.md
@@ -24,11 +24,11 @@ ![contra.png][logo] | ||
- [`λ.series`](#%CE%BBseriestasks-done) | ||
- [`λ.concurrent`](#%CE%BBconcurrenttasks-concurrency-done) | ||
- [`λ.concurrent`](#%CE%BBconcurrenttasks-cap-done) | ||
Functional | ||
- [`λ.each`](#%CE%BBeachitems-iterator-done) | ||
- [`λ.each`](#%CE%BBeachitems-cap-iterator-done) | ||
- [`λ.each.series`](#%CE%BBeachseriesitems-iterator-done) | ||
- [`λ.map`](#%CE%BBmapitems-iterator-done) | ||
- [`λ.map`](#%CE%BBmapitems-cap-iterator-done) | ||
- [`λ.map.series`](#%CE%BBmapseriesitems-iterator-done) | ||
- [`λ.filter`](#%CE%BBfilteritems-iterator-done) | ||
- [`λ.filter`](#%CE%BBfilteritems-cap-iterator-done) | ||
- [`λ.filter.series`](#%CE%BBfilterseriesitems-iterator-done) | ||
@@ -38,3 +38,3 @@ | ||
- [`λ.queue`](#%CE%BBqueueworker-concurrency1) | ||
- [`λ.queue`](#%CE%BBqueueworker-cap1) | ||
- [`λ.emitter`](#%CE%BBemitterthing) | ||
@@ -70,2 +70,4 @@ - [`λ.curry`](#%CE%BBcurryfn-arguments) | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
# API | ||
@@ -98,20 +100,21 @@ | ||
## `λ.series(tasks, done?)` | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
**Effectively an alias for `λ.concurrent(tasks, 1, done)`.** | ||
## `λ.concurrent(tasks, cap?, done?)` | ||
Executes tasks in series. `done` gets all the results. Results get passed as an array or hash to an optional `done` callback. Task order is preserved in results. | ||
Executes tasks concurrently. Results get passed as an array or hash to an optional `done` callback. Task order is preserved in results. You can set a concurrency cap, and it's uncapped by default. | ||
- `tasks` Collection of functions with the `(next)` signature. Can be an array or an object | ||
- `tasks` Collection of functions with the `(cb)` signature. Can be an array or an object | ||
- `cap` Optional concurrency level, used by the internal [queue](#%CE%BBqueueworker-cap1) | ||
- `done` Optional function with the `(err, results)` signature | ||
```js | ||
λ.series([ | ||
function (next) { | ||
λ.concurrent([ | ||
function (cb) { | ||
setTimeout(function () { | ||
next(null, 'boom'); | ||
cb(null, 'boom'); | ||
}, 1000); | ||
}, | ||
function (next) { | ||
next(null, 'foo'); | ||
function (cb) { | ||
cb(null, 'foo'); | ||
} | ||
@@ -127,10 +130,10 @@ ], function (err, results) { | ||
```js | ||
λ.series({ | ||
first: function (next) { | ||
λ.concurrent({ | ||
first: function (cb) { | ||
setTimeout(function () { | ||
next(null, 'boom'); | ||
cb(null, 'boom'); | ||
}, 1000); | ||
}, | ||
second: function (next) { | ||
next(null, 'foo'); | ||
second: function (cb) { | ||
cb(null, 'foo'); | ||
} | ||
@@ -143,19 +146,22 @@ }, function (err, results) { | ||
## `λ.concurrent(tasks, concurrency?, done?)` | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
Executes tasks concurrently. Results get passed as an array or hash to an optional `done` callback. Task order is preserved in results. You can set a concurrency cap, and it's uncapped by default. | ||
## `λ.series(tasks, done?)` | ||
- `tasks` Collection of functions with the `(cb)` signature. Can be an array or an object | ||
- `concurrency` Optional concurrency level, used by the internal [queue](#%CE%BBqueueworker-concurrency1) | ||
- `done` Optional function with the `(err, results)` signature | ||
**Effectively an alias for `λ.concurrent(tasks, 1, done?)`.** | ||
Executes tasks in series. `done` gets all the results. Results get passed as an array or hash to an optional `done` callback. Task order is preserved in results. | ||
- `tasks` Collection of functions with the `(next)` signature. Can be an array or an object | ||
- `done` <Opti></Opti>onal function with the `(err, results)` signature | ||
```js | ||
λ.concurrent([ | ||
function (cb) { | ||
λ.series([ | ||
function (next) { | ||
setTimeout(function () { | ||
cb(null, 'boom'); | ||
next(null, 'boom'); | ||
}, 1000); | ||
}, | ||
function (cb) { | ||
cb(null, 'foo'); | ||
function (next) { | ||
next(null, 'foo'); | ||
} | ||
@@ -171,10 +177,10 @@ ], function (err, results) { | ||
```js | ||
λ.concurrent({ | ||
first: function (cb) { | ||
λ.series({ | ||
first: function (next) { | ||
setTimeout(function () { | ||
cb(null, 'boom'); | ||
next(null, 'boom'); | ||
}, 1000); | ||
}, | ||
second: function (cb) { | ||
cb(null, 'foo'); | ||
second: function (next) { | ||
next(null, 'foo'); | ||
} | ||
@@ -187,8 +193,10 @@ }, function (err, results) { | ||
## `λ.each(items, concurrency?, iterator, done?)` | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
## `λ.each(items, cap?, iterator, done?)` | ||
Applies an iterator to each element in the collection concurrently. | ||
- `items` Collection of items. Can be an array or an object | ||
- `concurrency` Optional concurrency level, used by the internal [queue](#%CE%BBqueueworker-concurrency1) | ||
- `cap` Optional concurrency level, used by the internal [queue](#%CE%BBqueueworker-cap1) | ||
- `iterator(item, cb)` Function to execute on each item | ||
@@ -210,12 +218,16 @@ - `item` The current item | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
## `λ.each.series(items, iterator, done?)` | ||
Same as `λ.each(items, iterator, done?)`, but in series instead of concurrently. | ||
Effectively an alias for `λ.each(items, 1, iterator, done?)`. | ||
## `λ.map(items, concurrency?, iterator, done?)` | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
## `λ.map(items, cap?, iterator, done?)` | ||
Applies an iterator to each element in the collection concurrently. Produces an object with the transformation results. Task order is preserved in the results. | ||
- `items` Collection of items. Can be an array or an object | ||
- `concurrency` Optional concurrency level, used by the internal [queue](#%CE%BBqueueworker-concurrency1) | ||
- `cap` Optional concurrency level, used by the internal [queue](#%CE%BBqueueworker-cap1) | ||
- `iterator(item, cb)` Function to execute on each item | ||
@@ -237,12 +249,16 @@ - `item` The current item | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
## `λ.map.series(items, iterator, done?)` | ||
Same as `λ.map(items, iterator, done?)`, but in series instead of concurrently. | ||
Effectively an alias for `λ.map(items, 1, iterator, done?)`. | ||
## `λ.filter(items, concurrency?, iterator, done?)` | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
## `λ.filter(items, cap?, iterator, done?)` | ||
Applies an iterator to each element in the collection concurrently. Produces an object with the filtered results. Task order is preserved in results. | ||
- `items` Collection of items. Can be an array or an object | ||
- `concurrency` Optional concurrency level, used by the internal [queue](#%CE%BBqueueworker-concurrency1) | ||
- `cap` Optional concurrency level, used by the internal [queue](#%CE%BBqueueworker-cap1) | ||
- `iterator(item, cb)` Function to execute on each item | ||
@@ -266,8 +282,12 @@ - `item` The current item | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
## `λ.filter.series(items, iterator, done?)` | ||
Same as `λ.filter(items, iterator, done?)`, but in series instead of concurrently. | ||
Effectively an alias for `λ.filter(items, 1, iterator, done?)`. | ||
## `λ.queue(worker, concurrency=1)` | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
## `λ.queue(worker, cap=1)` | ||
Used to create a job queue. | ||
@@ -278,3 +298,3 @@ | ||
- `done` Needs to be called when processing for current job is done | ||
- `concurrency` Optional concurrency level, defaults to `1` (serial) | ||
- `cap` Optional concurrency level, defaults to `1` (serial) | ||
@@ -319,2 +339,4 @@ Returns a queue you can `push` or `unshift` jobs to. You can pause and resume the queue by hand. | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
## `λ.emitter(thing)` | ||
@@ -378,2 +400,4 @@ | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
## `λ.curry(fn, ...arguments)` | ||
@@ -388,2 +412,4 @@ | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
# Comparison with `async` | ||
@@ -404,2 +430,4 @@ | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
# Browser Support | ||
@@ -430,2 +458,4 @@ | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
# License | ||
@@ -435,2 +465,4 @@ | ||
<sub>[_Back to top_](#quick-links)</sub> | ||
[logo]: https://raw.github.com/bevacqua/contra/master/resources/contra.png | ||
@@ -437,0 +469,0 @@ [1]: https://github.com/caolan/async |
@@ -9,3 +9,3 @@ (function (Object, root) { | ||
function a (o) { return Object.prototype.toString.call(o) === '[object Array]'; } | ||
function atoa (a) { return Array.prototype.slice.call(a); } | ||
function atoa (a, n) { return Array.prototype.slice.call(a, n); } | ||
function cb (fn, args, ctx) { if (!fn) { return; } tick(function run () { fn.apply(ctx || null, args || []); }); } | ||
@@ -204,3 +204,3 @@ function once (fn) { | ||
load--; | ||
cb(job.done, atoa(arguments).splice(1)); | ||
cb(job.done, atoa(arguments, 1)); | ||
cb(labor); | ||
@@ -207,0 +207,0 @@ } |
'use strict'; | ||
var assert = require('assert'); | ||
var λ = require('..'); | ||
var λ = typeof contra !== 'undefined' ? contra : require('..'); | ||
var a = typeof assert !== 'undefined' ? assert : require('assert'); | ||
assert.falsy = function (value, message) { assert.equal(false, !!value, message); }; | ||
a.falsy = function (value, message) { a.equal(false, !!value, message); }; | ||
@@ -27,3 +27,3 @@ describe('concurrent()', function () { | ||
d(null, result); | ||
}, Math.random() * 100); | ||
}, Math.random()); | ||
}; | ||
@@ -33,7 +33,7 @@ } | ||
function d (err, results) { | ||
assert.deepEqual(results, items); | ||
a.deepEqual(results, items); | ||
done(); | ||
} | ||
λ.concurrent(tasks, 2, d); | ||
λ.concurrent(tasks, 4, d); | ||
}); | ||
@@ -56,13 +56,13 @@ }); | ||
done(null, item); | ||
}, Math.random() * 100); | ||
}, Math.random()); | ||
} | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.deepEqual(results, items); | ||
a.falsy(err); | ||
a.deepEqual(results, items); | ||
done(); | ||
} | ||
λ.map(items, 2, mapper, d); | ||
λ.map(items, 4, mapper, d); | ||
}); | ||
}); |
'use strict'; | ||
var assert = require('assert'); | ||
var λ = require('..'); | ||
var λ = typeof contra !== 'undefined' ? contra : require('..'); | ||
var a = typeof assert !== 'undefined' ? assert : require('assert'); | ||
assert.falsy = function (value, message) { assert.equal(false, !!value, message); }; | ||
a.falsy = function (value, message) { a.equal(false, !!value, message); }; | ||
@@ -13,3 +13,3 @@ describe('waterfall()', function () { | ||
cb = true; | ||
assert.falsy(cc); | ||
a.falsy(cc); | ||
next(null, 'a'); | ||
@@ -19,11 +19,11 @@ } | ||
cc = true; | ||
assert.ok(cb); | ||
assert.equal(d, 'a'); | ||
a.ok(cb); | ||
a.equal(d, 'a'); | ||
next(null, 'b'); | ||
} | ||
function d (err, result) { | ||
assert.falsy(err); | ||
assert.ok(cb); | ||
assert.ok(cc); | ||
assert.equal(result, 'b'); | ||
a.falsy(err); | ||
a.ok(cb); | ||
a.ok(cc); | ||
a.equal(result, 'b'); | ||
done(); | ||
@@ -40,3 +40,3 @@ } | ||
cb = true; | ||
assert.falsy(cc); | ||
a.falsy(cc); | ||
next(null, 'a'); | ||
@@ -46,12 +46,12 @@ } | ||
cc = true; | ||
assert.ok(cb); | ||
a.ok(cb); | ||
next(null, 'b'); | ||
} | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.ok(cb); | ||
assert.ok(cc); | ||
assert.equal(Object.keys(results).length, 2); | ||
assert.equal(results[0], 'a'); | ||
assert.equal(results[1], 'b'); | ||
a.falsy(err); | ||
a.ok(cb); | ||
a.ok(cc); | ||
a.equal(Object.keys(results).length, 2); | ||
a.equal(results[0], 'a'); | ||
a.equal(results[1], 'b'); | ||
done(); | ||
@@ -66,3 +66,3 @@ } | ||
cb = true; | ||
assert.falsy(cc); | ||
a.falsy(cc); | ||
next(null, 'a'); | ||
@@ -72,12 +72,12 @@ } | ||
cc = true; | ||
assert.ok(cb); | ||
a.ok(cb); | ||
next(null, 'b'); | ||
} | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.ok(cb); | ||
assert.ok(cc); | ||
assert.equal(Object.keys(results).length, 2); | ||
assert.equal(results.e, 'a'); | ||
assert.equal(results.f, 'b'); | ||
a.falsy(err); | ||
a.ok(cb); | ||
a.ok(cc); | ||
a.equal(Object.keys(results).length, 2); | ||
a.equal(results.e, 'a'); | ||
a.equal(results.f, 'b'); | ||
done(); | ||
@@ -92,3 +92,3 @@ } | ||
cb = true; | ||
assert.falsy(cc); | ||
a.falsy(cc); | ||
next('d', 'a'); | ||
@@ -98,11 +98,11 @@ } | ||
cc = true; | ||
assert.ok(cb); | ||
a.ok(cb); | ||
next(null, 'b'); | ||
} | ||
function d (err, results) { | ||
assert.ok(err); | ||
assert.equal(err, 'd'); | ||
assert.ok(cb); | ||
assert.falsy(cc); | ||
assert.falsy(results); | ||
a.ok(err); | ||
a.equal(err, 'd'); | ||
a.ok(cb); | ||
a.falsy(cc); | ||
a.falsy(results); | ||
done(); | ||
@@ -119,3 +119,3 @@ } | ||
cb = true; | ||
assert.falsy(cc); | ||
a.falsy(cc); | ||
next(null, 'a'); | ||
@@ -125,12 +125,12 @@ } | ||
cc = true; | ||
assert.ok(cb); | ||
a.ok(cb); | ||
next(null, 'b'); | ||
} | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.ok(cb); | ||
assert.ok(cc); | ||
assert.equal(Object.keys(results).length, 2); | ||
assert.equal(results[0], 'a'); | ||
assert.equal(results[1], 'b'); | ||
a.falsy(err); | ||
a.ok(cb); | ||
a.ok(cc); | ||
a.equal(Object.keys(results).length, 2); | ||
a.equal(results[0], 'a'); | ||
a.equal(results[1], 'b'); | ||
done(); | ||
@@ -145,3 +145,3 @@ } | ||
cb = true; | ||
assert.falsy(cc); | ||
a.falsy(cc); | ||
next(null, 'a'); | ||
@@ -151,12 +151,12 @@ } | ||
cc = true; | ||
assert.ok(cb); | ||
a.ok(cb); | ||
next(null, 'b'); | ||
} | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.ok(cb); | ||
assert.ok(cc); | ||
assert.equal(Object.keys(results).length, 2); | ||
assert.equal(results.a, 'a'); | ||
assert.equal(results.d, 'b'); | ||
a.falsy(err); | ||
a.ok(cb); | ||
a.ok(cc); | ||
a.equal(Object.keys(results).length, 2); | ||
a.equal(results.a, 'a'); | ||
a.equal(results.d, 'b'); | ||
done(); | ||
@@ -175,5 +175,5 @@ } | ||
function d (err, results) { | ||
assert.ok(err); | ||
assert.equal(err, 'b'); | ||
assert.falsy(results); | ||
a.ok(err); | ||
a.equal(err, 'b'); | ||
a.falsy(results); | ||
done(); | ||
@@ -187,6 +187,6 @@ } | ||
it('should work with no extra arguments', function () { | ||
var fn = function (a,b,c) { | ||
assert.equal(a, 1); | ||
assert.equal(b, 3); | ||
assert.equal(c, 'c'); | ||
var fn = function (b,c,d) { | ||
a.equal(b, 1); | ||
a.equal(c, 3); | ||
a.equal(d, 'c'); | ||
}; | ||
@@ -198,8 +198,8 @@ var applied = λ.curry(fn, 1, 3, 'c'); | ||
it('should include extra arguments as well', function () { | ||
var fn = function (a,b,c,d,e) { | ||
assert.equal(a, 1); | ||
assert.equal(b, 3); | ||
assert.equal(c, 'c'); | ||
assert.equal(d, 'd'); | ||
assert.equal(e, 'e'); | ||
var fn = function (b,c,d,e,f) { | ||
a.equal(b, 1); | ||
a.equal(c, 3); | ||
a.equal(d, 'c'); | ||
a.equal(e, 'd'); | ||
a.equal(f, 'e'); | ||
}; | ||
@@ -213,20 +213,20 @@ var applied = λ.curry(fn, 1, 3, 'c'); | ||
function b (n, next) { | ||
assert.equal(n, 1); | ||
a.equal(n, 1); | ||
cb = true; | ||
assert.falsy(cc); | ||
a.falsy(cc); | ||
next(null, 'd'); | ||
} | ||
function c (p, next) { | ||
assert.deepEqual(p, ['a']); | ||
a.deepEqual(p, ['a']); | ||
cc = true; | ||
assert.ok(cb); | ||
a.ok(cb); | ||
next(null, 'b'); | ||
} | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.ok(cb); | ||
assert.ok(cc); | ||
assert.equal(Object.keys(results).length, 2); | ||
assert.equal(results[0], 'd'); | ||
assert.equal(results[1], 'b'); | ||
a.falsy(err); | ||
a.ok(cb); | ||
a.ok(cc); | ||
a.equal(Object.keys(results).length, 2); | ||
a.equal(results[0], 'd'); | ||
a.equal(results[1], 'b'); | ||
done(); | ||
@@ -249,5 +249,5 @@ } | ||
function d (err, results) { | ||
assert.equal(n, 2); | ||
assert.falsy(err); | ||
assert.falsy(results); | ||
a.equal(n, 2); | ||
a.falsy(err); | ||
a.falsy(results); | ||
done(); | ||
@@ -265,5 +265,5 @@ } | ||
function d (err, results) { | ||
assert.equal(n, 2); | ||
assert.falsy(err); | ||
assert.falsy(results); | ||
a.equal(n, 2); | ||
a.falsy(err); | ||
a.falsy(results); | ||
done(); | ||
@@ -279,4 +279,4 @@ } | ||
function d (err, results) { | ||
assert.ok(err); | ||
assert.falsy(results); | ||
a.ok(err); | ||
a.falsy(results); | ||
done(); | ||
@@ -296,5 +296,5 @@ } | ||
function d (err, results) { | ||
assert.equal(n, 2); | ||
assert.falsy(err); | ||
assert.falsy(results); | ||
a.equal(n, 2); | ||
a.falsy(err); | ||
a.falsy(results); | ||
done(); | ||
@@ -312,5 +312,5 @@ } | ||
function d (err, results) { | ||
assert.equal(n, 2); | ||
assert.falsy(err); | ||
assert.falsy(results); | ||
a.equal(n, 2); | ||
a.falsy(err); | ||
a.falsy(results); | ||
done(); | ||
@@ -328,5 +328,5 @@ } | ||
function d (err, results) { | ||
assert.equal(n, 1); | ||
assert.ok(err); | ||
assert.falsy(results); | ||
a.equal(n, 1); | ||
a.ok(err); | ||
a.falsy(results); | ||
done(); | ||
@@ -345,5 +345,5 @@ } | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.equal(Object.keys(results).length, 2); | ||
assert.deepEqual(results, [4, 5]); | ||
a.falsy(err); | ||
a.equal(Object.keys(results).length, 2); | ||
a.deepEqual(results, [4, 5]); | ||
done(); | ||
@@ -360,5 +360,5 @@ } | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.equal(Object.keys(results).length, 2); | ||
assert.deepEqual(results, { a: 4, b: 5 }); | ||
a.falsy(err); | ||
a.equal(Object.keys(results).length, 2); | ||
a.deepEqual(results, { a: 4, b: 5 }); | ||
done(); | ||
@@ -374,4 +374,4 @@ } | ||
function d (err, results) { | ||
assert.ok(err); | ||
assert.falsy(results); | ||
a.ok(err); | ||
a.falsy(results); | ||
done(); | ||
@@ -390,5 +390,5 @@ } | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.equal(Object.keys(results).length, 2); | ||
assert.deepEqual(results, [4, 5]); | ||
a.falsy(err); | ||
a.equal(Object.keys(results).length, 2); | ||
a.deepEqual(results, [4, 5]); | ||
done(); | ||
@@ -405,5 +405,5 @@ } | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.equal(Object.keys(results).length, 2); | ||
assert.deepEqual(results, { a: 4, b: 5 }); | ||
a.falsy(err); | ||
a.equal(Object.keys(results).length, 2); | ||
a.deepEqual(results, { a: 4, b: 5 }); | ||
done(); | ||
@@ -419,4 +419,4 @@ } | ||
function d (err, results) { | ||
assert.ok(err); | ||
assert.falsy(results); | ||
a.ok(err); | ||
a.falsy(results); | ||
done(); | ||
@@ -434,5 +434,5 @@ } | ||
function d (err, results) { | ||
assert.equal(n, 1); | ||
assert.ok(err); | ||
assert.falsy(results); | ||
a.equal(n, 1); | ||
a.ok(err); | ||
a.falsy(results); | ||
done(); | ||
@@ -451,5 +451,5 @@ } | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.equal(results.length, 2); | ||
assert.deepEqual(results, ['b', 'c']); | ||
a.falsy(err); | ||
a.equal(results.length, 2); | ||
a.deepEqual(results, ['b', 'c']); | ||
done(); | ||
@@ -465,5 +465,5 @@ } | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.equal(Object.keys(results).length, 2); | ||
assert.deepEqual(results, { a: 'b', b: 'c' }); | ||
a.falsy(err); | ||
a.equal(Object.keys(results).length, 2); | ||
a.deepEqual(results, { a: 'b', b: 'c' }); | ||
done(); | ||
@@ -479,4 +479,4 @@ } | ||
function d (err, results) { | ||
assert.ok(err); | ||
assert.falsy(results); | ||
a.ok(err); | ||
a.falsy(results); | ||
done(); | ||
@@ -494,5 +494,5 @@ } | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.equal(results.length, 2); | ||
assert.deepEqual(results, ['b', 'c']); | ||
a.falsy(err); | ||
a.equal(results.length, 2); | ||
a.deepEqual(results, ['b', 'c']); | ||
done(); | ||
@@ -508,5 +508,5 @@ } | ||
function d (err, results) { | ||
assert.falsy(err); | ||
assert.equal(Object.keys(results).length, 2); | ||
assert.deepEqual(results, { a: 'b', b: 'c' }); | ||
a.falsy(err); | ||
a.equal(Object.keys(results).length, 2); | ||
a.deepEqual(results, { a: 'b', b: 'c' }); | ||
done(); | ||
@@ -523,8 +523,8 @@ } | ||
ww = true; | ||
assert.equal(job, 'a'); | ||
a.equal(job, 'a'); | ||
done(); | ||
} | ||
function d (err) { | ||
assert.falsy(err); | ||
assert.ok(ww); | ||
a.falsy(err); | ||
a.ok(ww); | ||
done(); | ||
@@ -540,8 +540,8 @@ } | ||
ww = true; | ||
assert.equal(job, 'a'); | ||
a.equal(job, 'a'); | ||
cb(); | ||
} | ||
function d (err) { | ||
assert.falsy(err); | ||
assert.ok(ww); | ||
a.falsy(err); | ||
a.ok(ww); | ||
done(); | ||
@@ -552,3 +552,3 @@ } | ||
q.push('a', d); | ||
assert.equal(q.pending.length, 1); | ||
a.equal(q.pending.length, 1); | ||
q.resume(); | ||
@@ -561,8 +561,8 @@ }); | ||
ww = true; | ||
assert.equal(job, 'a'); | ||
a.equal(job, 'a'); | ||
done('e'); | ||
} | ||
function d (err) { | ||
assert.equal(err, 'e'); | ||
assert.ok(ww); | ||
a.equal(err, 'e'); | ||
a.ok(ww); | ||
done(); | ||
@@ -577,9 +577,9 @@ } | ||
function w () { | ||
assert.fail(null, null, 'invoked worker'); | ||
a.fail(null, null, 'invoked worker'); | ||
} | ||
function d () { | ||
assert.fail(null, null, 'invoked job completion'); | ||
a.fail(null, null, 'invoked job completion'); | ||
} | ||
function drained () { | ||
assert.falsy(ww); | ||
a.falsy(ww); | ||
done(); | ||
@@ -599,10 +599,10 @@ } | ||
assert.ok(thing.on); | ||
assert.ok(thing.once); | ||
assert.ok(thing.off); | ||
assert.ok(thing.emit); | ||
a.ok(thing.on); | ||
a.ok(thing.once); | ||
a.ok(thing.off); | ||
a.ok(thing.emit); | ||
thing.on('something', function (a, b) { | ||
assert.equal(a, 'a'); | ||
assert.equal(b, 2); | ||
thing.on('something', function (b, c) { | ||
a.equal(b, 'a'); | ||
a.equal(c, 2); | ||
done(); | ||
@@ -622,3 +622,3 @@ }); | ||
c++; | ||
assert.ok(c < 2); | ||
a.ok(c < 2); | ||
done(); | ||
@@ -629,3 +629,3 @@ } | ||
thing.on('something', function () { | ||
assert.equal(c, 1); | ||
a.equal(c, 1); | ||
}); | ||
@@ -652,3 +652,3 @@ | ||
function me () { | ||
assert.fail(null, null, 'invoked on() listener'); | ||
a.fail(null, null, 'invoked on() listener'); | ||
} | ||
@@ -668,3 +668,3 @@ | ||
function me () { | ||
assert.fail(null, null, 'invoked once() listener'); | ||
a.fail(null, null, 'invoked once() listener'); | ||
} | ||
@@ -683,3 +683,3 @@ | ||
assert.throws(thing.emit.bind(thing, 'error')); | ||
a.throws(thing.emit.bind(thing, 'error')); | ||
done(); | ||
@@ -696,4 +696,4 @@ }); | ||
}); | ||
assert.doesNotThrow(thing.emit.bind(thing, 'error')); | ||
a.doesNotThrow(thing.emit.bind(thing, 'error')); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
229606
34
6738
457
10
2