Socket
Socket
Sign inDemoInstall

when

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

when - npm Package Compare versions

Comparing version 3.4.4 to 3.4.5

39

es6-shim/Promise.js

@@ -489,6 +489,8 @@ !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.Promise=e():"undefined"!=typeof global?global.Promise=e():"undefined"!=typeof self&&(self.Promise=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

var parent = this._handler;
var state = parent.join().state();
if (typeof onFulfilled !== 'function' && parent.join().state() > 0) {
if ((typeof onFulfilled !== 'function' && state > 0) ||
(typeof onRejected !== 'function' && state < 0)) {
// Short circuit: value will not change, simply share handler
return new Promise(Handler, parent);
return new this.constructor(Handler, parent);
}

@@ -554,5 +556,3 @@

if (maybeThenable(x)) {
h = isPromise(x)
? x._handler.join()
: getHandlerUntrusted(x);
h = getHandlerMaybeThenable(x);

@@ -566,2 +566,3 @@ s = h.state();

} else {
unreportRemaining(promises, i+1, h);
resolver.become(h);

@@ -592,2 +593,16 @@ break;

function unreportRemaining(promises, start, rejectedHandler) {
var i, h, x;
for(i=start; i<promises.length; ++i) {
x = promises[i];
if(maybeThenable(x)) {
h = getHandlerMaybeThenable(x);
if(h !== rejectedHandler) {
h.visit(h, void 0, h._unreport);
}
}
}
}
/**

@@ -641,2 +656,12 @@ * Fulfill-reject competitive race. Return a promise that will settle

/**
* Get a handler for thenable x.
* NOTE: You must only call this if maybeThenable(x) == true
* @param {object|function|Promise} x
* @returns {object} handler
*/
function getHandlerMaybeThenable(x) {
return isPromise(x) ? x._handler.join() : getHandlerUntrusted(x);
}
/**
* Get a handler for potentially untrusted thenable x

@@ -1153,3 +1178,5 @@ * @param {*} x

} catch (e) {
setTimer = function(f, ms) { return setTimeout(f, ms); };
// NOTE: Truncate decimals to workaround node 0.10.30 bug:
// https://github.com/joyent/node/issues/8167
setTimer = function(f, ms) { return setTimeout(f, ms|0); };
clearTimer = function(t) { return clearTimeout(t); };

@@ -1156,0 +1183,0 @@ }

@@ -10,2 +10,3 @@ /** @license MIT License (c) copyright 2010-2014 original author or authors */

var resolve = Promise.resolve;
var reject = Promise.reject;

@@ -77,6 +78,22 @@ var origCatch = Promise.prototype['catch'];

var isolated = isolate(handler);
return this.then(isolated, isolated)['yield'](this);
return this.then(function(x) {
return runSideEffect(handler, this, identity, x);
}, function(e) {
return runSideEffect(handler, this, reject, e);
});
};
function runSideEffect (handler, thisArg, propagate, value) {
var result = handler.call(thisArg);
return maybeThenable(result)
? propagateValue(result, propagate, value)
: propagate(value);
}
function propagateValue (result, propagate, x) {
return resolve(result).then(function () {
return propagate(x);
});
}
/**

@@ -136,9 +153,11 @@ * Recover from a failure by returning a defaultValue. If defaultValue

function isolate(f) {
return function() {
return f.call(this);
};
function maybeThenable(x) {
return (typeof x === 'object' || typeof x === 'function') && x !== null;
}
function identity(x) {
return x;
}
});
}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));

@@ -131,6 +131,8 @@ /** @license MIT License (c) copyright 2010-2014 original author or authors */

var parent = this._handler;
var state = parent.join().state();
if (typeof onFulfilled !== 'function' && parent.join().state() > 0) {
if ((typeof onFulfilled !== 'function' && state > 0) ||
(typeof onRejected !== 'function' && state < 0)) {
// Short circuit: value will not change, simply share handler
return new Promise(Handler, parent);
return new this.constructor(Handler, parent);
}

@@ -196,5 +198,3 @@

if (maybeThenable(x)) {
h = isPromise(x)
? x._handler.join()
: getHandlerUntrusted(x);
h = getHandlerMaybeThenable(x);

@@ -208,2 +208,3 @@ s = h.state();

} else {
unreportRemaining(promises, i+1, h);
resolver.become(h);

@@ -234,2 +235,16 @@ break;

function unreportRemaining(promises, start, rejectedHandler) {
var i, h, x;
for(i=start; i<promises.length; ++i) {
x = promises[i];
if(maybeThenable(x)) {
h = getHandlerMaybeThenable(x);
if(h !== rejectedHandler) {
h.visit(h, void 0, h._unreport);
}
}
}
}
/**

@@ -283,2 +298,12 @@ * Fulfill-reject competitive race. Return a promise that will settle

/**
* Get a handler for thenable x.
* NOTE: You must only call this if maybeThenable(x) == true
* @param {object|function|Promise} x
* @returns {object} handler
*/
function getHandlerMaybeThenable(x) {
return isPromise(x) ? x._handler.join() : getHandlerUntrusted(x);
}
/**
* Get a handler for potentially untrusted thenable x

@@ -285,0 +310,0 @@ * @param {*} x

2

package.json
{
"name": "when",
"version": "3.4.4",
"version": "3.4.5",
"description": "A lightweight Promises/A+ and when() implementation, plus other async goodies.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -8,3 +8,3 @@ /** @license MIT License (c) copyright 2010-2014 original author or authors */

* @author John Hann
* @version 3.4.4
* @version 3.4.5
*/

@@ -11,0 +11,0 @@ (function(define) { 'use strict';

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