arbitrary-promise
Advanced tools
Comparing version 1.0.1 to 1.1.0
@@ -120,2 +120,5 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
_this2._state[stateKey].forEach(handler); | ||
// return this for chaining | ||
return _this2; | ||
}; | ||
@@ -129,2 +132,5 @@ | ||
_this2[handlerKey] && _this2[handlerKey](data); | ||
// return this for chaining | ||
return _this2; | ||
}; | ||
@@ -131,0 +137,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.arbitraryPromise=e():t.arbitraryPromise=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(t){i=!0,a=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=function(){function t(e){if(r(this,t),!this._validatePassReceivePairs(e))throw new Error("must pass in tuples of function names like [['handleData', 'onData'], ...]");this._createState(),e.forEach(this._processPassReceivePair.bind(this))}return i(t,[{key:"clear",value:function(){this._resetState()}},{key:"_createState",value:function(){this._state={}}},{key:"_resetState",value:function(){var t=this;Object.keys(this._state).forEach(function(e){t._state[e]=[]})}},{key:"_processPassReceivePair",value:function(t){var e=this,r=n(t,2),i=r[0],a=r[1],o="__state_"+i,s="__handler_"+a;this._state[o]=[],this[a]=function(t){e[s]=t,e._state[o].forEach(t)},this[i]=function(t){e._state[o].push(t),e[s]&&e[s](t)}}},{key:"_validatePassReceivePairs",value:function(t){var e=Array.isArray(t);if(!e)return!1;var r=t.length>=1;if(!r)return!1;var n=t.every(function(t){return 2===t.length});if(!n)return!1;var i=t.every(function(t){return"string"==typeof t[0]&&"string"==typeof t[1]});return!!i}}]),t}();t.exports=a}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.arbitraryPromise=e():t.arbitraryPromise=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var n=function(){function t(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(t){i=!0,a=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}return r}return function(e,r){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),a=function(){function t(e){if(r(this,t),!this._validatePassReceivePairs(e))throw new Error("must pass in tuples of function names like [['handleData', 'onData'], ...]");this._createState(),e.forEach(this._processPassReceivePair.bind(this))}return i(t,[{key:"clear",value:function(){this._resetState()}},{key:"_createState",value:function(){this._state={}}},{key:"_resetState",value:function(){var t=this;Object.keys(this._state).forEach(function(e){t._state[e]=[]})}},{key:"_processPassReceivePair",value:function(t){var e=this,r=n(t,2),i=r[0],a=r[1],o="__state_"+i,s="__handler_"+a;this._state[o]=[],this[a]=function(t){return e[s]=t,e._state[o].forEach(t),e},this[i]=function(t){return e._state[o].push(t),e[s]&&e[s](t),e}}},{key:"_validatePassReceivePairs",value:function(t){var e=Array.isArray(t);if(!e)return!1;var r=t.length>=1;if(!r)return!1;var n=t.every(function(t){return 2===t.length});if(!n)return!1;var i=t.every(function(t){return"string"==typeof t[0]&&"string"==typeof t[1]});return!!i}}]),t}();t.exports=a}])}); | ||
//# sourceMappingURL=arbitrary-promise.min.js.map |
@@ -64,2 +64,5 @@ 'use strict'; | ||
_this2._state[stateKey].forEach(handler); | ||
// return this for chaining | ||
return _this2; | ||
}; | ||
@@ -73,2 +76,5 @@ | ||
_this2[handlerKey] && _this2[handlerKey](data); | ||
// return this for chaining | ||
return _this2; | ||
}; | ||
@@ -75,0 +81,0 @@ } |
{ | ||
"name": "arbitrary-promise", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "ArbitraryPromise is a simple Promise library that allows you to make your own arbitrarily named resolve/then functions.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is not supported yet
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
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
56471
255