Socket
Socket
Sign inDemoInstall

q

Package Overview
Dependencies
Maintainers
0
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.2.0 to 0.2.1

q/examples/delay.js

29

q/lib/q.js

@@ -141,2 +141,3 @@

pending = undefined;
return value;
};

@@ -148,3 +149,3 @@

"reject": function (reason) {
resolve(reject(reason));
return resolve(reject(reason));
}

@@ -178,3 +179,2 @@ };

promise.emit = function (op, resolved /* ...args */) {
resolved = resolved || identity;
var args = Array.prototype.slice.call(arguments, 2);

@@ -186,2 +186,3 @@ var result;

result = fallback.apply(descriptor, arguments);
resolved = resolved || identity;
return resolved(result);

@@ -248,4 +249,4 @@ };

}, function fallback(op, resolved) {
var rejection = reject(reason);
return resolved ? resolved(rejection) : rejection;
resolved = resolved || identity;
return resolved(reject(reason));
}, function valueOf() {

@@ -288,2 +289,5 @@ var rejection = create(reject.prototype);

var args = Array.prototype.slice.call(arguments, 1);
var method = object[name];
if (!method) throw new Error("No such method " + name + " on object " + object);
if (!method.apply) throw new Error("Property " + name + " on object " + object + " is not a method");
return object[name].apply(object, args);

@@ -305,16 +309,13 @@ }

*/
exports.def = function (object) {
exports.def = def;
function def(object) {
return Promise({
"isDef": function () {}
}, function fallback(op, resolve) {
}, function fallback(op, resolved) {
var args = Array.prototype.slice.call(arguments, 2);
var result = send.apply(undefined, [object, op].concat(args));
// TODO? return resolve ? resolve(result) : result;
return result;
resolved = resolved || identity;
return resolved(result);
}, function valueOf() {
return {
'toString': function () {
return '[object Promise def]'
}
};
return object.valueOf();
});

@@ -373,3 +374,3 @@ }

*
* /!\ WARNING: this method is expiermental and likely
* /!\ WARNING: this method is experimental and likely
* to be removed on the grounds that it probably

@@ -376,0 +377,0 @@ * will result in composition hazards.

{
"name": "q",
"description": "defer/when-style promises (CommonJS/Promises/B)",
"version": "0.2.0",
"version": "0.2.1",
"homepage": "http://github.com/kriskowal/q/",

@@ -22,2 +22,6 @@ "author": "Kris Kowal <kris@cixar.com> (http://github.com/kriskowal/)",

"main": "lib/q.js",
"modules": {
"util": "./lib/q/util.js",
"queue": "./lib/q/queue.js"
},
"repository": {

@@ -24,0 +28,0 @@ "type": "git",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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