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.9 to 0.8.10

14

package.json
{
"name": "q",
"version": "0.8.9",
"version": "0.8.10",
"description": "A library for promises (CommonJS/Promises/A,B,D)",
"homepage": "http://github.com/kriskowal/q/",
"author": "Kris Kowal <kris@cixar.com> (http://github.com/kriskowal/)",
"homepage": "https://github.com/kriskowal/q",
"author": "Kris Kowal <kris@cixar.com> (https://github.com/kriskowal)",
"keywords": [

@@ -18,3 +18,3 @@ "q",

"contributors": [
"Kris Kowal <kris@cixar.com> (http://github.com/kriskowal/)",
"Kris Kowal <kris@cixar.com> (https://github.com/kriskowal)",
"Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)",

@@ -36,3 +36,3 @@ "Domenic Denicola <domenic@domenicdenicola.com> (http://domenicdenicola.com)"

"type": "git",
"url": "http://github.com/kriskowal/q.git"
"url": "git://github.com/kriskowal/q.git"
},

@@ -45,3 +45,3 @@ "engines": {

"devDependencies": {
"jshint": ">=0.7.3",
"jshint": ">=0.9.1",
"cover": "*",

@@ -54,3 +54,3 @@ "jasmine-node": "*",

"test-browser": "opener spec/q-spec.html",
"lint": "jshint --show-non-errors q.js",
"lint": "jshint q.js",
"cover": "cover run node_modules/jasmine-node/bin/jasmine-node spec && cover report html && opener cover_html/index.html"

@@ -57,0 +57,0 @@ },

114

q.js
// vim:ts=4:sts=4:sw=4:
/*jshint browser: true, node: true,
curly: true, eqeqeq: true, noarg: true, nonew: true, trailing: true,
undef: true */
/*global define: false, Q: true, msSetImmediate: false, setImmediate: false,
ReturnValue: false, cajaVM: false, ses: false */
/*!

@@ -127,8 +122,4 @@ *

nextTick = process.nextTick;
} else if (typeof msSetImmediate === "function") {
// IE 10 only, at the moment
// And yes, ``bind``ing to ``window`` is necessary O_o.
nextTick = msSetImmediate.bind(window);
} else if (typeof setImmediate === "function") {
// https://github.com/NobleJS/setImmediate
// In IE10, or use https://github.com/NobleJS/setImmediate
nextTick = setImmediate;

@@ -503,3 +494,2 @@ } else if (typeof MessageChannel !== "undefined") {

progressListeners = void 0;
return value;
}

@@ -512,11 +502,9 @@

deferred.reject = function (exception) {
return become(reject(exception));
become(reject(exception));
};
deferred.notify = function () {
deferred.notify = function (progress) {
if (pending) {
var args = arguments;
array_reduce(progressListeners, function (undefined, progressListener) {
nextTick(function () {
progressListener.apply(void 0, args);
progressListener(progress);
});

@@ -624,2 +612,6 @@ }, void 0);

makePromise.prototype.thenResolve = function (value) {
return when(this, function () { return value; });
};
// Chainable methods

@@ -638,6 +630,6 @@ array_reduce(

"timeout", "delay",
"catch", "finally", "fail", "fin", "progress", "end",
"catch", "finally", "fail", "fin", "progress", "end", "done",
"ncall", "napply", "nbind",
"npost", "ninvoke",
"nend"
"nend", "nodeify"
],

@@ -682,5 +674,6 @@ function (undefined, name) {

return value;
} else {
} else if (isPromise(value)) {
return value.valueOf();
}
return value;
}

@@ -954,2 +947,6 @@

function _progressed(value) {
return progressed ? progressed(value) : value;
}
var resolvedValue = resolve(value);

@@ -974,6 +971,6 @@ nextTick(function () {

// Progress listeners need to be attached in the current tick.
if (progressed) {
resolvedValue.promiseSend("when", void 0, void 0, progressed);
}
// Progress propagator need to be attached in the current tick.
resolvedValue.promiseSend("when", void 0, void 0, function (value) {
deferred.notify(_progressed(value));
});

@@ -998,3 +995,3 @@ return deferred.promise;

return fulfilled.apply(void 0, values);
});
}, rejected);
}, rejected);

@@ -1386,4 +1383,3 @@ }

function progress(promise, progressed) {
when(promise, void 0, void 0, progressed);
return promise;
return when(promise, void 0, void 0, progressed);
}

@@ -1422,5 +1418,6 @@

*/
exports.end = end; // XXX stopgap
function end(promise) {
when(promise, void 0, function (error) {
exports.end = deprecate(done, "end", "done"); // XXX deprecated, use done
exports.done = done;
function done(promise, fulfilled, rejected, progress) {
function onUnhandledError(error) {
// forward to a future turn so that ``when``

@@ -1431,3 +1428,3 @@ // does not catch it and turn it into a rejection.

// trace by removing Node and Q cruft, then concatenating with
// the stack trace of the promise we are ``end``ing. See #57.
// the stack trace of the promise we are ``done``ing. See #57.
var errorStackFrames;

@@ -1441,12 +1438,27 @@ if (

var combinedStackFrames = errorStackFrames.concat(
"From previous event:",
promiseStackFrames
);
error.stack = formatStackTrace(error, combinedStackFrames);
// Check to make sure the stack trace hasn't already been
// rendered (possibly by us).
if (typeof errorStackFrames !== "string") {
var combinedStackFrames = errorStackFrames.concat(
"From previous event:",
promiseStackFrames
);
error.stack = formatStackTrace(error, combinedStackFrames);
}
}
throw error;
if (exports.onerror) {
exports.onerror(error);
} else {
throw error;
}
});
});
}
// Avoid unnecessary `nextTick`ing via an unnecessary `when`.
var promiseToHandle = fulfilled || rejected || progress ?
when(promise, fulfilled, rejected, progress) :
promise;
fail(promiseToHandle, onUnhandledError);
}

@@ -1534,3 +1546,3 @@

* .then(console.log)
* .end()
* .done()
*

@@ -1573,3 +1585,8 @@ */

function npost(object, name, args) {
return napply(object[name], object, args);
var nodeArgs = array_slice(args);
var deferred = defer();
nodeArgs.push(deferred.makeNodeResolver());
post(object, name, nodeArgs).fail(deferred.reject);
return deferred.promise;
}

@@ -1589,13 +1606,16 @@

function ninvoke(object, name /*, ...args*/) {
var args = array_slice(arguments, 2);
return napply(object[name], object, args);
var nodeArgs = array_slice(arguments, 2);
var deferred = defer();
nodeArgs.push(deferred.makeNodeResolver());
post(object, name, nodeArgs).fail(deferred.reject);
return deferred.promise;
}
exports.nend = nend;
function nend(promise, nodeback) {
exports.nend = deprecate(nodeify, "nend", "nodeify"); // XXX deprecated, use nodeify
exports.nodeify = nodeify;
function nodeify(promise, nodeback) {
if (nodeback) {
var deferred = defer();
promise.then(function (value) {
nextTick(function () {
deferred.resolve();
nodeback(null, value);

@@ -1605,7 +1625,5 @@ });

nextTick(function () {
deferred.resolve();
nodeback(error);
});
});
return deferred.promise;
} else {

@@ -1616,4 +1634,2 @@ return promise;

defend(exports);
// All code before this point will be filtered from stack traces.

@@ -1620,0 +1636,0 @@ var qEndingLine = captureLine();

@@ -41,3 +41,3 @@ [![Build Status](https://secure.travis-ci.org/kriskowal/q.png)](http://travis-ci.org/kriskowal/q)

})
.end();
.done();
```

@@ -372,3 +372,3 @@

})
.end()
.done()
```

@@ -621,3 +621,3 @@

[reference]: q/wiki/API-Reference
[reference]: https://github.com/kriskowal/q/wiki/API-Reference

@@ -624,0 +624,0 @@ ## More Examples

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