Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vow

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vow - npm Package Compare versions

Comparing version 0.4.6 to 0.4.7

258

lib/vow.js
/**
* @module vow
* @author Filatov Dmitry <dfilatov@yandex-team.ru>
* @version 0.4.6
* @version 0.4.7
* @license

@@ -13,2 +13,125 @@ * Dual licensed under the MIT and GPL licenses:

var undef,
nextTick = (function() {
var fns = [],
enqueueFn = function(fn) {
return fns.push(fn) === 1;
},
callFns = function() {
var fnsToCall = fns, i = 0, len = fns.length;
fns = [];
while(i < len) {
fnsToCall[i++]();
}
};
if(typeof setImmediate === 'function') { // ie10, nodejs >= 0.10
return function(fn) {
enqueueFn(fn) && setImmediate(callFns);
};
}
if(typeof process === 'object' && process.nextTick) { // nodejs < 0.10
return function(fn) {
enqueueFn(fn) && process.nextTick(callFns);
};
}
if(global.postMessage) { // modern browsers
var isPostMessageAsync = true;
if(global.attachEvent) {
var checkAsync = function() {
isPostMessageAsync = false;
};
global.attachEvent('onmessage', checkAsync);
global.postMessage('__checkAsync', '*');
global.detachEvent('onmessage', checkAsync);
}
if(isPostMessageAsync) {
var msg = '__promise' + +new Date,
onMessage = function(e) {
if(e.data === msg) {
e.stopPropagation && e.stopPropagation();
callFns();
}
};
global.addEventListener?
global.addEventListener('message', onMessage, true) :
global.attachEvent('onmessage', onMessage);
return function(fn) {
enqueueFn(fn) && global.postMessage(msg, '*');
};
}
}
var doc = global.document;
if('onreadystatechange' in doc.createElement('script')) { // ie6-ie8
var createScript = function() {
var script = doc.createElement('script');
script.onreadystatechange = function() {
script.parentNode.removeChild(script);
script = script.onreadystatechange = null;
callFns();
};
(doc.documentElement || doc.body).appendChild(script);
};
return function(fn) {
enqueueFn(fn) && createScript();
};
}
return function(fn) { // old browsers
enqueueFn(fn) && setTimeout(callFns, 0);
};
})(),
throwException = function(e) {
nextTick(function() {
throw e;
});
},
isFunction = function(obj) {
return typeof obj === 'function';
},
isObject = function(obj) {
return obj !== null && typeof obj === 'object';
},
toStr = Object.prototype.toString,
isArray = Array.isArray || function(obj) {
return toStr.call(obj) === '[object Array]';
},
getArrayKeys = function(arr) {
var res = [],
i = 0, len = arr.length;
while(i < len) {
res.push(i++);
}
return res;
},
getObjectKeys = Object.keys || function(obj) {
var res = [];
for(var i in obj) {
obj.hasOwnProperty(i) && res.push(i);
}
return res;
},
defineCustomErrorType = function(name) {
var res = function(message) {
this.name = name;
this.message = message;
};
res.prototype = new Error();
return res;
},
wrapOnFulfilled = function(onFulfilled, idx) {
return function(val) {
onFulfilled.call(this, val, idx);
};
};
/**

@@ -404,3 +527,3 @@ * @class Deferred

function() {
defer.reject(Error('timed out'));
defer.reject(new vow.TimedOutError('timed out'));
},

@@ -975,8 +1098,5 @@ timeout);

iterable,
function() {
function(value, idx) {
res[keys[idx]] = value;
if(!--i) {
var j = 0;
while(j < len) {
res[keys[j]] = vow.valueOf(iterable[keys[j++]]);
}
defer.resolve(res);

@@ -1080,3 +1200,3 @@ }

/**
* Returns a promise to be fulfilled only when any of the items in `iterable` are fulfilled,
* Returns a promise to be fulfilled only when any of the items in `iterable` is fulfilled,
* or to be rejected when all the items are rejected (with the reason of the first rejected item).

@@ -1111,3 +1231,3 @@ *

/**
* Returns a promise to be fulfilled only when any of the items in `iterable` are fulfilled,
* Returns a promise to be fulfilled only when any of the items in `iterable` is fulfilled,
* or to be rejected when the first item is rejected.

@@ -1164,117 +1284,17 @@ *

i = 0;
while(i < len) {
vow.when(promises[keys? keys[i] : i], onFulfilled, onRejected, onProgress, ctx);
vow.when(
promises[keys? keys[i] : i],
wrapOnFulfilled(onFulfilled, i),
onRejected,
onProgress,
ctx);
++i;
}
}
},
TimedOutError : defineCustomErrorType('TimedOut')
};
var undef,
nextTick = (function() {
var fns = [],
enqueueFn = function(fn) {
return fns.push(fn) === 1;
},
callFns = function() {
var fnsToCall = fns, i = 0, len = fns.length;
fns = [];
while(i < len) {
fnsToCall[i++]();
}
};
if(typeof setImmediate === 'function') { // ie10, nodejs >= 0.10
return function(fn) {
enqueueFn(fn) && setImmediate(callFns);
};
}
if(typeof process === 'object' && process.nextTick) { // nodejs < 0.10
return function(fn) {
enqueueFn(fn) && process.nextTick(callFns);
};
}
if(global.postMessage) { // modern browsers
var isPostMessageAsync = true;
if(global.attachEvent) {
var checkAsync = function() {
isPostMessageAsync = false;
};
global.attachEvent('onmessage', checkAsync);
global.postMessage('__checkAsync', '*');
global.detachEvent('onmessage', checkAsync);
}
if(isPostMessageAsync) {
var msg = '__promise' + +new Date,
onMessage = function(e) {
if(e.data === msg) {
e.stopPropagation && e.stopPropagation();
callFns();
}
};
global.addEventListener?
global.addEventListener('message', onMessage, true) :
global.attachEvent('onmessage', onMessage);
return function(fn) {
enqueueFn(fn) && global.postMessage(msg, '*');
};
}
}
var doc = global.document;
if('onreadystatechange' in doc.createElement('script')) { // ie6-ie8
var createScript = function() {
var script = doc.createElement('script');
script.onreadystatechange = function() {
script.parentNode.removeChild(script);
script = script.onreadystatechange = null;
callFns();
};
(doc.documentElement || doc.body).appendChild(script);
};
return function(fn) {
enqueueFn(fn) && createScript();
};
}
return function(fn) { // old browsers
enqueueFn(fn) && setTimeout(callFns, 0);
};
})(),
throwException = function(e) {
nextTick(function() {
throw e;
});
},
isFunction = function(obj) {
return typeof obj === 'function';
},
isObject = function(obj) {
return obj !== null && typeof obj === 'object';
},
toStr = Object.prototype.toString,
isArray = Array.isArray || function(obj) {
return toStr.call(obj) === '[object Array]';
},
getArrayKeys = function(arr) {
var res = [],
i = 0, len = arr.length;
while(i < len) {
res.push(i++);
}
return res;
},
getObjectKeys = Object.keys || function(obj) {
var res = [];
for(var i in obj) {
obj.hasOwnProperty(i) && res.push(i);
}
return res;
};
var defineAsGlobal = true;

@@ -1281,0 +1301,0 @@ if(typeof module === 'object' && typeof module.exports === 'object') {

{
"name" : "vow",
"version" : "0.4.6",
"version" : "0.4.7",
"description" : "DOM Promise and Promises/A+ implementation for Node.js and browsers",

@@ -5,0 +5,0 @@ "homepage" : "http://dfilatov.github.io/vow/",

**NOTE**. Documentation for old versions of the library can be found at https://github.com/dfilatov/vow/blob/0.3.x/README.md.
<a href="http://promises-aplus.github.com/promises-spec"><img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png" align="right" /></a>
Vow 0.4.5 [![NPM version](https://badge.fury.io/js/vow.png)](http://badge.fury.io/js/vow) [![Build Status](https://secure.travis-ci.org/dfilatov/vow.png)](http://travis-ci.org/dfilatov/vow)
Vow 0.4.7 [![NPM version](https://badge.fury.io/js/vow.png)](http://badge.fury.io/js/vow) [![Build Status](https://secure.travis-ci.org/dfilatov/vow.png)](http://travis-ci.org/dfilatov/vow)
=========

@@ -6,0 +6,0 @@

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