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

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.6.3 to 3.6.4

lib/format.js

89

es6-shim/Promise.js

@@ -35,3 +35,3 @@ !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){

},{"./Scheduler":3,"./env":5,"./makePromise":6}],3:[function(require,module,exports){
},{"./Scheduler":3,"./env":5,"./makePromise":7}],3:[function(require,module,exports){
/** @license MIT License (c) copyright 2010-2014 original author or authors */

@@ -127,2 +127,3 @@ /** @author Brian Cavalier */

var setTimer = require('../env').setTimer;
var format = require('../format');

@@ -167,3 +168,3 @@ return function unhandledRejection(Promise) {

reported.push(r);
logError('Potentially unhandled rejection [' + r.id + '] ' + formatError(r.value));
logError('Potentially unhandled rejection [' + r.id + '] ' + format.formatError(r.value));
}

@@ -176,3 +177,3 @@ }

reported.splice(i, 1);
logInfo('Handled previous rejection [' + r.id + '] ' + formatObject(r.value));
logInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));
}

@@ -198,24 +199,2 @@ }

function formatError(e) {
var s = typeof e === 'object' && e.stack ? e.stack : formatObject(e);
return e instanceof Error ? s : s + ' (WARNING: non-Error used)';
}
function formatObject(o) {
var s = String(o);
if(s === '[object Object]' && typeof JSON !== 'undefined') {
s = tryStringify(o, s);
}
return s;
}
function tryStringify(e, defaultValue) {
try {
return JSON.stringify(e);
} catch(e) {
// Ignore. Cannot JSON.stringify e, stick with String(e)
return defaultValue;
}
}
function throwit(e) {

@@ -230,3 +209,3 @@ throw e;

},{"../env":5}],5:[function(require,module,exports){
},{"../env":5,"../format":6}],5:[function(require,module,exports){
/** @license MIT License (c) copyright 2010-2014 original author or authors */

@@ -314,2 +293,60 @@ /** @author Brian Cavalier */

return {
formatError: formatError,
formatObject: formatObject,
tryStringify: tryStringify
};
/**
* Format an error into a string. If e is an Error and has a stack property,
* it's returned. Otherwise, e is formatted using formatObject, with a
* warning added about e not being a proper Error.
* @param {*} e
* @returns {String} formatted string, suitable for output to developers
*/
function formatError(e) {
var s = typeof e === 'object' && e !== null && e.stack ? e.stack : formatObject(e);
return e instanceof Error ? s : s + ' (WARNING: non-Error used)';
}
/**
* Format an object, detecting "plain" objects and running them through
* JSON.stringify if possible.
* @param {Object} o
* @returns {string}
*/
function formatObject(o) {
var s = String(o);
if(s === '[object Object]' && typeof JSON !== 'undefined') {
s = tryStringify(o, s);
}
return s;
}
/**
* Try to return the result of JSON.stringify(x). If that fails, return
* defaultValue
* @param {*} x
* @param {*} defaultValue
* @returns {String|*} JSON.stringify(x) or defaultValue
*/
function tryStringify(x, defaultValue) {
try {
return JSON.stringify(x);
} catch(e) {
return defaultValue;
}
}
});
}(typeof define === 'function' && define.amd ? define : function(factory) { module.exports = factory(); }));
},{}],7:[function(require,module,exports){
/** @license MIT License (c) copyright 2010-2014 original author or authors */
/** @author Brian Cavalier */
/** @author John Hann */
(function(define) { 'use strict';
define(function() {
return function makePromise(environment) {

@@ -316,0 +353,0 @@

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

var setTimer = require('../env').setTimer;
var format = require('../format');

@@ -49,3 +50,3 @@ return function unhandledRejection(Promise) {

reported.push(r);
logError('Potentially unhandled rejection [' + r.id + '] ' + formatError(r.value));
logError('Potentially unhandled rejection [' + r.id + '] ' + format.formatError(r.value));
}

@@ -58,3 +59,3 @@ }

reported.splice(i, 1);
logInfo('Handled previous rejection [' + r.id + '] ' + formatObject(r.value));
logInfo('Handled previous rejection [' + r.id + '] ' + format.formatObject(r.value));
}

@@ -80,24 +81,2 @@ }

function formatError(e) {
var s = typeof e === 'object' && e.stack ? e.stack : formatObject(e);
return e instanceof Error ? s : s + ' (WARNING: non-Error used)';
}
function formatObject(o) {
var s = String(o);
if(s === '[object Object]' && typeof JSON !== 'undefined') {
s = tryStringify(o, s);
}
return s;
}
function tryStringify(e, defaultValue) {
try {
return JSON.stringify(e);
} catch(e) {
// Ignore. Cannot JSON.stringify e, stick with String(e)
return defaultValue;
}
}
function throwit(e) {

@@ -104,0 +83,0 @@ throw e;

{
"name": "when",
"version": "3.6.3",
"version": "3.6.4",
"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.6.3
* @version 3.6.4
*/

@@ -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