Comparing version 1.0.12 to 1.0.13
{ | ||
"name": "contra", | ||
"description": "Asynchronous flow control with a `_` taste to it", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"homepage": "https://github.com/bevacqua/contra", | ||
@@ -26,5 +26,15 @@ "author": { | ||
], | ||
"dependencies": {}, | ||
"ignore": [".editorconfig", "package.json", "node_modules", "src", "test", "resources"], | ||
"main": "dist/contra.js" | ||
"main": "dist/contra.js", | ||
"ignore": [ | ||
".editorconfig", | ||
"package.json", | ||
"node_modules", | ||
"src", | ||
"test", | ||
"resources", | ||
"index.js", | ||
"shim.js", | ||
"gulpfile.js" | ||
], | ||
"dependencies": {} | ||
} |
@@ -39,6 +39,6 @@ (function (Object) { | ||
var method = args.shift(); | ||
return function curried (next) { | ||
return function curried () { | ||
var copy = atoa(args); | ||
copy.push(next); | ||
method.apply(method, copy); | ||
var more = atoa(arguments); | ||
method.apply(method, copy.concat(more)); | ||
}; | ||
@@ -140,8 +140,8 @@ } | ||
var me = this; | ||
var sub = {}; | ||
var evt = {}; | ||
thing.on = function (type, fn) { | ||
if (!sub[type]) { | ||
sub[type] = [fn]; | ||
if (!evt[type]) { | ||
evt[type] = [fn]; | ||
} else { | ||
sub[type].push(fn); | ||
evt[type].push(fn); | ||
} | ||
@@ -152,6 +152,6 @@ }; | ||
var type = args.shift(); | ||
var st = sub[type]; | ||
if (type === 'error' && !st) { throw args.length === 1 ? args[0] : args; } | ||
if (!st) { return; } | ||
st.forEach(function emitter (s) { cb(s, args, me); }); | ||
var et = evt[type]; | ||
if (type === 'error' && !et) { throw args.length === 1 ? args[0] : args; } | ||
if (!et) { return; } | ||
et.forEach(function emitter (s) { cb(s, args, me); }); | ||
}; | ||
@@ -158,0 +158,0 @@ return thing; |
@@ -1,1 +0,1 @@ | ||
!function(n){"use strict";function t(t){return"[object Array]"===n.prototype.toString.call(t)}function e(n){return Array.prototype.slice.call(n)}function r(n,t,e){n&&h(function(){n.apply(e||null,t||[])})}function u(n){function t(){e||(e=!0,n.apply(null,arguments))}var e;return t.discard=function(){e=!0},t}function i(n,t,e){var u=n.shift();return u?(e&&e.discard(),r(t,[u]),!0):void 0}function o(){var n=e(arguments),t=n.shift();return function(r){var u=e(n);u.push(r),t.apply(t,u)}}function f(n,t){function o(){var f=u(t);return u(function(){var t=e(arguments),u=n.shift();if(u){if(i(t,f))return;t.push(o()),r(u,t)}else r(f,arguments)})}o()()}function c(o,f){function c(){return u(function(){var n=p.shift(),t=e(arguments),u=o[n];if(a){if(i(t,s))return;l[a]=t.shift()}a=n,u?r(u,[c()]):r(s,[null,l])})}var a,s=u(f),p=n.keys(o),l=t(o)?[]:{};c()()}function a(o,f){function c(n){var t=u(function(){var u=e(arguments);i(u,a,t)||(p[n]=u.shift(),++l===h&&r(a,[null,p]))});return t}var a=u(f),s=n.keys(o),p=t(o)?[]:{},l=0,h=s.length;s.forEach(function(n){r(o[n],[c(n)])})}function s(e,r){return function(u,i,o){var f=n.keys(u),c=t(u)?[]:{};f.forEach(function(n){c[n]=function(t){i(u[n],t)}}),e(c,r?r(o):o)}}function p(n){function t(n){return function(t){n(t)}}return s(n,t)}function l(n){var t=this,u={};return n.on=function(n,t){u[n]?u[n].push(t):u[n]=[t]},n.emit=function(){var n=e(arguments),i=n.shift(),o=u[i];if("error"===i&&!o)throw 1===n.length?n[0]:n;o&&o.forEach(function(e){r(e,n,t)})},n}var h,m="function"==typeof setImmediate;h="undefined"!=typeof process&&process.nextTick?m?setImmediate:process.nextTick:m?function(n){setImmediate(n)}:function(n){setTimeout(n,0)};var d=function(e,i){function o(n,e,u){var i=e?"unshift":"push",o=t(n)?n:[n];o.forEach(function(n){s[i]({t:n,done:u})}),r(f)}function f(){if(!(a||p>=l)&&s.length){p++;var n=s.pop();e(n.t,u(c.bind(null,n)))}}function c(n,t){p--,r(n.done,[t]),r(f)}var a,s=[],p=0,l=i||1,h={push:function(n,t){o(n,!1,t)},unshift:function(n,t){o(n,!0,t)},pause:function(){a=!0},resume:function(){a=!1,f()}};return n.defineProperty(h,"length",{get:function(){return s.length}}),h},v={apply:o,concurrent:a,series:c,waterfall:f,each:p(a),map:s(a),queue:d,emitter:l};v.each.series=p(c),v.map.series=s(c),"undefined"!=typeof module&&module.exports?module.exports=v:window.contra=v}(Object); | ||
!function(n){"use strict";function t(t){return"[object Array]"===n.prototype.toString.call(t)}function e(n){return Array.prototype.slice.call(n)}function r(n,t,e){n&&h(function(){n.apply(e||null,t||[])})}function u(n){function t(){e||(e=!0,n.apply(null,arguments))}var e;return t.discard=function(){e=!0},t}function i(n,t,e){var u=n.shift();return u?(e&&e.discard(),r(t,[u]),!0):void 0}function o(){var n=e(arguments),t=n.shift();return function(){var r=e(n),u=e(arguments);t.apply(t,r.concat(u))}}function f(n,t){function o(){var f=u(t);return u(function(){var t=e(arguments),u=n.shift();if(u){if(i(t,f))return;t.push(o()),r(u,t)}else r(f,arguments)})}o()()}function c(o,f){function c(){return u(function(){var n=l.shift(),t=e(arguments),u=o[n];if(a){if(i(t,s))return;p[a]=t.shift()}a=n,u?r(u,[c()]):r(s,[null,p])})}var a,s=u(f),l=n.keys(o),p=t(o)?[]:{};c()()}function a(o,f){function c(n){var t=u(function(){var u=e(arguments);i(u,a,t)||(l[n]=u.shift(),++p===h&&r(a,[null,l]))});return t}var a=u(f),s=n.keys(o),l=t(o)?[]:{},p=0,h=s.length;s.forEach(function(n){r(o[n],[c(n)])})}function s(e,r){return function(u,i,o){var f=n.keys(u),c=t(u)?[]:{};f.forEach(function(n){c[n]=function(t){i(u[n],t)}}),e(c,r?r(o):o)}}function l(n){function t(n){return function(t){n(t)}}return s(n,t)}function p(n){var t=this,u={};return n.on=function(n,t){u[n]?u[n].push(t):u[n]=[t]},n.emit=function(){var n=e(arguments),i=n.shift(),o=u[i];if("error"===i&&!o)throw 1===n.length?n[0]:n;o&&o.forEach(function(e){r(e,n,t)})},n}var h,m="function"==typeof setImmediate;h="undefined"!=typeof process&&process.nextTick?m?setImmediate:process.nextTick:m?function(n){setImmediate(n)}:function(n){setTimeout(n,0)};var d=function(e,i){function o(n,e,u){var i=e?"unshift":"push",o=t(n)?n:[n];o.forEach(function(n){s[i]({t:n,done:u})}),r(f)}function f(){if(!(a||l>=p)&&s.length){l++;var n=s.pop();e(n.t,u(c.bind(null,n)))}}function c(n,t){l--,r(n.done,[t]),r(f)}var a,s=[],l=0,p=i||1,h={push:function(n,t){o(n,!1,t)},unshift:function(n,t){o(n,!0,t)},pause:function(){a=!0},resume:function(){a=!1,f()}};return n.defineProperty(h,"length",{get:function(){return s.length}}),h},v={apply:o,concurrent:a,series:c,waterfall:f,each:l(a),map:s(a),queue:d,emitter:p};v.each.series=l(c),v.map.series=s(c),"undefined"!=typeof module&&module.exports?module.exports=v:window.contra=v}(Object); |
@@ -65,3 +65,3 @@ 'use strict'; | ||
.pipe(git.tag(v, message)) | ||
.pipe(git.push('origin', 'master')) | ||
.pipe(git.push('origin', 'master', '--tags')) | ||
.pipe(gulp.dest('./')); | ||
@@ -68,0 +68,0 @@ }); |
{ | ||
"name": "contra", | ||
"description": "Asynchronous flow control with a `_` taste to it", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"homepage": "https://github.com/bevacqua/contra", | ||
@@ -6,0 +6,0 @@ "author": { |
![contra.png][logo] | ||
[<img src="https://travis-ci.org/bevacqua/contra.png?branch=master" align="right" />](https://travis-ci.org/bevacqua/contra) | ||
[![badge](https://travis-ci.org/bevacqua/contra.png?branch=master)](https://travis-ci.org/bevacqua/contra) [![badge](https://badge.fury.io/js/contra.png)](http://badge.fury.io/js/contra) [![badge](https://badge.fury.io/bo/contra.png)](http://badge.fury.io/bo/contra) | ||
@@ -5,0 +5,0 @@ > Asynchronous flow control with a `_` taste to it |
@@ -39,6 +39,6 @@ (function (Object) { | ||
var method = args.shift(); | ||
return function curried (next) { | ||
return function curried () { | ||
var copy = atoa(args); | ||
copy.push(next); | ||
method.apply(method, copy); | ||
var more = atoa(arguments); | ||
method.apply(method, copy.concat(more)); | ||
}; | ||
@@ -140,8 +140,8 @@ } | ||
var me = this; | ||
var sub = {}; | ||
var evt = {}; | ||
thing.on = function (type, fn) { | ||
if (!sub[type]) { | ||
sub[type] = [fn]; | ||
if (!evt[type]) { | ||
evt[type] = [fn]; | ||
} else { | ||
sub[type].push(fn); | ||
evt[type].push(fn); | ||
} | ||
@@ -152,6 +152,6 @@ }; | ||
var type = args.shift(); | ||
var st = sub[type]; | ||
if (type === 'error' && !st) { throw args.length === 1 ? args[0] : args; } | ||
if (!st) { return; } | ||
st.forEach(function emitter (s) { cb(s, args, me); }); | ||
var et = evt[type]; | ||
if (type === 'error' && !et) { throw args.length === 1 ? args[0] : args; } | ||
if (!et) { return; } | ||
et.forEach(function emitter (s) { cb(s, args, me); }); | ||
}; | ||
@@ -158,0 +158,0 @@ return thing; |
@@ -171,3 +171,27 @@ 'use strict'; | ||
describe('apply()', function () { | ||
it('should just work', function (done) { | ||
it('should work with no extra arguments', function () { | ||
var fn = function (a,b,c) { | ||
arguments.length.should.equal(3); | ||
a.should.equal(1); | ||
b.should.equal(3); | ||
c.should.equal('c'); | ||
}; | ||
var applied = λ.apply(fn, 1, 3, 'c'); | ||
applied(); | ||
}); | ||
it('should include extra arguments as well', function () { | ||
var fn = function (a,b,c,d,e) { | ||
arguments.length.should.equal(5); | ||
a.should.equal(1); | ||
b.should.equal(3); | ||
c.should.equal('c'); | ||
d.should.equal('d'); | ||
e.should.equal('e'); | ||
}; | ||
var applied = λ.apply(fn, 1, 3, 'c'); | ||
applied('d', 'e'); | ||
}); | ||
it('should play well with λ.series', function (done) { | ||
var cb = false, cc = false; | ||
@@ -174,0 +198,0 @@ function b (n, next) { |
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
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
42978
1021