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

q

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

q - npm Package Compare versions

Comparing version 0.8.5 to 0.8.6

15

package.json
{
"name": "q",
"version": "0.8.5",
"version": "0.8.6",
"description": "A library for promises (CommonJS/Promises/A,B,D)",

@@ -38,3 +38,3 @@ "homepage": "http://github.com/kriskowal/q/",

"engines": {
"node": ">=0.2.0",
"node": ">=0.6.0",
"teleport": ">=0.2.0"

@@ -44,7 +44,10 @@ },

"devDependencies": {
"test": ">=0.3.0",
"jshint": "*"
"jshint": ">=0.7.1",
"cover": "*",
"jasmine-node": "*"
},
"scripts": {
"test": "node test/all.js"
"test": "jasmine-node spec",
"lint": "jshint --show-non-errors q.js",
"cover": "cover run node_modules/jasmine-node/bin/jasmine-node spec && cover report html"
},

@@ -59,4 +62,4 @@ "overlay": {

"directories": {
"test": "./test"
"test": "./spec"
}
}

127

q.js

@@ -5,4 +5,4 @@ // vim:ts=4:sts=4:sw=4:

undef: true */
/*global define: false, Q: true, msSetImmediate: true, setImmediate: true,
MessageChannel: true, ReturnValue: true, cajaVM: true, ses: true */
/*global define: false, Q: true, msSetImmediate: false, setImmediate: false,
ReturnValue: false, cajaVM: false, ses: false */
/*!

@@ -63,2 +63,4 @@ *

(function (definition) {
// Turn off strict mode for this function so we can assign to global.Q
/*jshint strict: false*/

@@ -97,2 +99,6 @@ // This file will function properly as a <script> tag, or a module

// All code after this point will be filtered from stack traces.
captureLine(new Error());
// shims

@@ -353,2 +359,10 @@

function isInternalFrame(fileName, frame) {
if (fileName !== qFileName) {
return false;
}
var line = frame.getLineNumber();
return line >= qStartingLine && line <= qEndingLine;
}
/*

@@ -374,3 +388,3 @@ * Retrieves an array of structured stack frames parsed from the ``stack``

fileName !== "node.js" &&
fileName !== qFileName
!isInternalFrame(fileName, frame)
);

@@ -387,7 +401,8 @@ });

// discover own file name for filtering stack traces
var qFileName;
if (Error.captureStackTrace) {
qFileName = (function () {
var fileName;
// discover own file name and line number range for filtering stack
// traces
var qFileName, qStartingLine, qEndingLine;
function captureLine(objectWithStack) {
if (Error.captureStackTrace) {
var fileName, lineNumber;

@@ -398,2 +413,3 @@ var oldPrepareStackTrace = Error.prepareStackTrace;

fileName = frames[0].getFileName();
lineNumber = frames[0].getLineNumber();
};

@@ -403,11 +419,24 @@

// JSHint and Closure Compiler generate known warnings here
new Error().stack;
/*jshint expr: true */
objectWithStack.stack;
Error.prepareStackTrace = oldPrepareStackTrace;
qFileName = fileName;
if (qStartingLine) {
qEndingLine = lineNumber;
} else {
qStartingLine = lineNumber;
}
}
}
return fileName;
})();
function deprecate(fn, name, alternative) {
return function () {
if (typeof console !== "undefined" && typeof console.warn === "function") {
console.warn(name + " is deprecated, use " + alternative + " instead.");
}
return fn.apply(fn, arguments);
};
}
// end of shims

@@ -496,3 +525,2 @@ // beginning of real work

*/
defer.prototype.node = // XXX deprecated
defer.prototype.makeNodeResolver = function () {

@@ -510,2 +538,4 @@ var self = this;

};
// XXX deprecated
defer.prototype.node = deprecate(defer.prototype.makeNodeResolver, "node", "makeNodeResolver");

@@ -633,2 +663,4 @@ /**

// generates a known JSHint "constructor invocation without new" warning
// supposed to be fixed, but isn't? https://github.com/jshint/jshint/issues/392
/*jshint newcap: false */
if (Object(value) !== value) {

@@ -722,3 +754,3 @@ return value;

exports.resolve = resolve;
exports.ref = resolve; // XXX deprecated, use resolve
exports.ref = deprecate(resolve, "ref", "resolve"); // XXX deprecated, use resolve
function resolve(object) {

@@ -888,9 +920,15 @@ // If the object is already a Promise, return it directly. This enables

resolve(value).promiseSend("when", function (value) {
if (done) {
return;
}
done = true;
resolve(value).promiseSend("when", function (value) {
if (done) {
return;
}
done = true;
deferred.resolve(_fulfilled(value));
}, function (exception) {
if (done) {
return;
}
done = true;
deferred.resolve(_rejected(exception));

@@ -903,2 +941,3 @@ });

done = true;
deferred.resolve(_rejected(exception));

@@ -1008,4 +1047,4 @@ });

*/
exports.sender = sender; // XXX deprecated, use dispatcher
exports.Method = sender; // XXX deprecated, use dispatcher
exports.sender = deprecate(sender, "sender", "dispatcher"); // XXX deprecated, use dispatcher
exports.Method = deprecate(sender, "Method", "dispatcher"); // XXX deprecated, use dispatcher
function sender(op) {

@@ -1025,3 +1064,3 @@ return function (object) {

*/
exports.send = send; // XXX deprecated, use dispatch
exports.send = deprecate(send, "send", "dispatch"); // XXX deprecated, use dispatch
function send(object, op) {

@@ -1133,3 +1172,4 @@ var deferred = defer();

*/
var apply = exports.apply = dispatcher("apply"); // XXX deprecated, use fapply
// XXX deprecated, use fapply
var apply = exports.apply = deprecate(dispatcher("apply"), "apply", "fapply");

@@ -1149,3 +1189,4 @@ /**

*/
exports.call = call; // XXX deprecated, use fcall
// XXX deprecated, use fcall
exports.call = deprecate(call, "call", "fcall");
function call(value, thisp) {

@@ -1175,3 +1216,3 @@ var args = array_slice(arguments, 2);

*/
exports.bind = bind; // XXX deprecated, use fbind
exports.bind = deprecate(bind, "bind", "fbind"); // XXX deprecated, use fbind
function bind(value, thisp) {

@@ -1226,9 +1267,16 @@ var args = array_slice(arguments, 2);

array_reduce(promises, function (undefined, promise, index) {
when(promise, function (value) {
promises[index] = value;
if (isFulfilled(promise)) {
promises[index] = valueOf(promise);
if (--countDown === 0) {
deferred.resolve(promises);
}
})
.fail(deferred.reject);
} else {
when(promise, function (value) {
promises[index] = value;
if (--countDown === 0) {
deferred.resolve(promises);
}
})
.fail(deferred.reject);
}
}, void 0);

@@ -1314,4 +1362,5 @@ return deferred.promise;

// the stack trace of the promise we are ``end``ing. See #57.
if (Error.captureStackTrace) {
var errorStackFrames = getStackFrames(error);
var errorStackFrames;
if (Error.captureStackTrace && typeof error === "object" &&
(errorStackFrames = getStackFrames(error))) {
var promiseStackFrames = getStackFrames(promise);

@@ -1342,6 +1391,10 @@

var deferred = defer();
when(promise, deferred.resolve, deferred.reject);
setTimeout(function () {
deferred.reject(new Error("Timed out after " + ms + "ms"));
var timeoutId = setTimeout(function () {
deferred.reject(new Error("Timed out after " + ms + " ms"));
}, ms);
when(promise, function (value) {
clearTimeout(timeoutId);
deferred.resolve(value);
}, deferred.reject);
return deferred.promise;

@@ -1446,3 +1499,3 @@ }

function npost(object, name, args) {
return napply(object[name], name, args);
return napply(object[name], object, args);
}

@@ -1463,3 +1516,3 @@

var args = array_slice(arguments, 2);
return napply(object[name], name, args);
return napply(object[name], object, args);
}

@@ -1469,2 +1522,6 @@

captureLine(new Error());
// All code before this point will be filtered from stack traces.
});
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