Socket
Socket
Sign inDemoInstall

promise-polyfill

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promise-polyfill - npm Package Compare versions

Comparing version 1.0.6 to 1.1.0

.travis.yml

41

package.json
{
"name": "promise-polyfill",
"version": "1.0.6",
"description": "Light weight promise polyfill. A+ compliant",
"main": "Promise.js",
"scripts": {
"test": "./node_modules/.bin/promises-aplus-tests tests/adapter.js"
},
"repository": {
"type": "git",
"url": "https://taylorhakes@github.com/taylorhakes/promise-polyfill.git"
},
"author": "Taylor Hakes",
"license": "MIT",
"bugs": {
"url": "https://github.com/taylorhakes/promise-polyfill/issues"
},
"homepage": "https://github.com/taylorhakes/promise-polyfill",
"devDependencies": {
"promises-aplus-tests": "^2.0.3"
}
"name": "promise-polyfill",
"version": "1.1.0",
"description": "Light weight promise polyfill. A+ compliant",
"main": "Promise.js",
"scripts": {
"test": "./node_modules/.bin/promises-aplus-tests tests/adapter.js"
},
"repository": {
"type": "git",
"url": "https://taylorhakes@github.com/taylorhakes/promise-polyfill.git"
},
"author": "Taylor Hakes",
"license": "MIT",
"bugs": {
"url": "https://github.com/taylorhakes/promise-polyfill/issues"
},
"homepage": "https://github.com/taylorhakes/promise-polyfill",
"devDependencies": {
"promises-aplus-tests": "^2.0.3"
},
"dependencies": {}
}

@@ -8,3 +8,38 @@ (function(global) {

var asap = global.setImmediate || function(fn){ setTimeout(fn, 0) };
var asap = (function() {
var callbacks, timeout, hiddenDiv;
if(global.process && process.nextTick === 'function') {
return process.nextTick;
} else if(global.MutationObserver) {
callbacks = [];
hiddenDiv = document.createElement("div");
(new MutationObserver(executeCallbacks)).observe(hiddenDiv, { attributes: true });
return function (callback) {
if( !callbacks.length) {
hiddenDiv.setAttribute('yes', 'no');
}
callbacks.push(callback);
};
} else if(global.setImmediate) {
return global.setImmediate;
} else {
callbacks = [];
return function (callback){
callbacks.push(callback);
if(!timeout) {
timeout = setTimeout(executeCallbacks, 0);
}
};
}
function executeCallbacks() {
var cbList = callbacks;
timeout = void 0;
callbacks = [];
for(var i = 0, len = cbList.length; i < len; i++) {
cbList[i]();
}
}
})();
function bind(fn, thisArg) {

@@ -168,7 +203,7 @@ return function() {

return new Promise(function (resolve, reject) {
values.map(function(value){
value.then(resolve, reject);
})
for(var i = 0, len = values.length; i < len; i++) {
values[i].then(resolve, reject);
}
});
};
})(this);
})(this);

@@ -1,5 +0,6 @@

(function(g){function e(a,b){return function(){a.apply(b,arguments)}}function q(a){return Array.isArray?Array.isArray(a):"[object Array]"===Object.prototype.toString.call(a)}function c(a){if("object"!==typeof this)throw new TypeError("Promises must be constructed via new");if("function"!==typeof a)throw new TypeError("not a function");this._value=this._state=null;this._deferreds=[];l(a,e(m,this),e(h,this))}function n(a){var b=this;null===this._state?this._deferreds.push(a):r(function(){var f=b._state?
a.onFulfilled:a.onRejected;if(null===f)(b._state?a.resolve:a.reject)(b._value);else{var d;try{d=f(b._value)}catch(c){a.reject(c);return}a.resolve(d)}})}function m(a){try{if(a===this)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"===typeof a||"function"===typeof a)){var b=a.then;if("function"===typeof b){l(e(b,a),e(m,this),e(h,this));return}}this._state=!0;this._value=a;p.call(this)}catch(f){h.call(this,f)}}function h(a){this._state=!1;this._value=a;p.call(this)}function p(){for(var a=
0,b=this._deferreds.length;a<b;a++)n.call(this,this._deferreds[a]);this._deferreds=null}function s(a,b,f,d){this.onFulfilled="function"===typeof a?a:null;this.onRejected="function"===typeof b?b:null;this.resolve=f;this.reject=d}function l(a,b,f){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,f(a))})}catch(c){d||(d=!0,f(c))}}"undefined"!==typeof module&&module.exports?module.exports=g.Promise?g.Promise:c:g.Promise||(g.Promise=c);var r=g.setImmediate||function(a){setTimeout(a,0)};c.prototype["catch"]=
function(a){return this.then(null,a)};c.prototype.then=function(a,b){var f=this;return new c(function(d,c){n.call(f,new s(a,b,d,c))})};c.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&q(arguments[0])?arguments[0]:arguments);return new c(function(b,c){function d(e,k){try{if(k&&("object"===typeof k||"function"===typeof k)){var h=k.then;if("function"===typeof h){h.call(k,function(a){d(e,a)},c);return}}a[e]=k;0===--g&&b(a)}catch(l){c(l)}}if(0===a.length)return b([]);for(var g=a.length,
e=0;e<a.length;e++)d(e,a[e])})};c.resolve=function(a){return new c(function(b){b(a)})};c.reject=function(a){return new c(function(b,c){c(a)})};c.race=function(a){return new c(function(b,c){a.map(function(a){a.then(b,c)})})}})(this);
(function(f){function g(a,b){return function(){a.apply(b,arguments)}}function r(a){return Array.isArray?Array.isArray(a):"[object Array]"===Object.prototype.toString.call(a)}function e(a){if("object"!==typeof this)throw new TypeError("Promises must be constructed via new");if("function"!==typeof a)throw new TypeError("not a function");this._value=this._state=null;this._deferreds=[];m(a,g(n,this),g(k,this))}function p(a){var b=this;null===this._state?this._deferreds.push(a):s(function(){var d=b._state?
a.onFulfilled:a.onRejected;if(null===d)(b._state?a.resolve:a.reject)(b._value);else{var c;try{c=d(b._value)}catch(l){a.reject(l);return}a.resolve(c)}})}function n(a){try{if(a===this)throw new TypeError("A promise cannot be resolved with itself.");if(a&&("object"===typeof a||"function"===typeof a)){var b=a.then;if("function"===typeof b){m(g(b,a),g(n,this),g(k,this));return}}this._state=!0;this._value=a;q.call(this)}catch(d){k.call(this,d)}}function k(a){this._state=!1;this._value=a;q.call(this)}function q(){for(var a=
0,b=this._deferreds.length;a<b;a++)p.call(this,this._deferreds[a]);this._deferreds=null}function t(a,b,d,c){this.onFulfilled="function"===typeof a?a:null;this.onRejected="function"===typeof b?b:null;this.resolve=d;this.reject=c}function m(a,b,d){var c=!1;try{a(function(a){c||(c=!0,b(a))},function(a){c||(c=!0,d(a))})}catch(l){c||(c=!0,d(l))}}"undefined"!==typeof module&&module.exports?module.exports=f.Promise?f.Promise:e:f.Promise||(f.Promise=e);var s=function(){function a(){var a=b;d=void 0;b=[];
for(var c=0,e=a.length;c<e;c++)a[c]()}var b,d,c;if(f.process&&"function"===process.nextTick)return process.nextTick;if(f.MutationObserver)return b=[],c=document.createElement("div"),(new MutationObserver(a)).observe(c,{attributes:!0}),function(a){b.length||c.setAttribute("yes","no");b.push(a)};if(f.setImmediate)return f.setImmediate;b=[];return function(c){b.push(c);d||(d=setTimeout(a,0))}}();e.prototype["catch"]=function(a){return this.then(null,a)};e.prototype.then=function(a,b){var d=this;return new e(function(c,
e){p.call(d,new t(a,b,c,e))})};e.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&r(arguments[0])?arguments[0]:arguments);return new e(function(b,d){function c(f,h){try{if(h&&("object"===typeof h||"function"===typeof h)){var g=h.then;if("function"===typeof g){g.call(h,function(a){c(f,a)},d);return}}a[f]=h;0===--e&&b(a)}catch(k){d(k)}}if(0===a.length)return b([]);for(var e=a.length,f=0;f<a.length;f++)c(f,a[f])})};e.resolve=function(a){return new e(function(b){b(a)})};e.reject=
function(a){return new e(function(b,d){d(a)})};e.race=function(a){return new e(function(b,d){for(var c=0,e=a.length;c<e;c++)a[c].then(b,d)})}})(this);

@@ -1,7 +0,10 @@

Promise
<a href="http://promises-aplus.github.com/promises-spec">
<img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png"
align="right" alt="Promises/A+ logo" />
</a>
Promise [![Build Status](https://travis-ci.org/taylorhakes/promise-polyfill.png?branch=master)](https://travis-ci.org/taylorhakes/promise-polyfill) ![https://david-dm.org/taylorhakes/promise-polyfill/dev-status.png](https://david-dm.org/taylorhakes/promise-polyfill/dev-status.png)
=============
Light weight promise polyfill for the browser and node. A+ Compliant. It is a perfect polyfill IE, Firefox or any other browser that does not support native promises.
Lightweight promise polyfill for the browser and node. A+ Compliant. It is a perfect polyfill IE, Firefox or any other browser that does not support native promises.
This implementation is based on [then/promise](https://github.com/then/promise). It has been changed to use the prototype for performance and memory reasons.

@@ -11,3 +14,3 @@

It is extremely light weight. ***< 1kb Gzipped***
It is extremely lightweight. ***< 1kb Gzipped***

@@ -14,0 +17,0 @@ ## Downloads

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc