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

ff

Package Overview
Dependencies
Maintainers
3
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ff - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

43

lib/ff.js

@@ -35,4 +35,8 @@ /*

function isPromise(maybePromise) {
return maybePromise && typeof maybePromise.then === "function";
var setImmediate = this.setImmediate || function (next) {
setTimeout(next, 0);
};
function isPromise(p) {
return p && (typeof p === "object" || typeof p === "function") && typeof p.then === "function";
}

@@ -272,12 +276,18 @@

SuperGroup.prototype.then = function (onSuccess, onError) {
SuperGroup.prototype.then = function (onFulfilled, onRejected) {
var defer = ff.defer();
this.onSuccess(function () {
try {
if (typeof onSuccess !== "function") {
if (typeof onFulfilled !== "function") {
defer.apply(this, slice.call(arguments));
} else {
var value = onSuccess.apply(this, slice.call(arguments));
var value = onFulfilled.apply(undefined, slice.call(arguments));
if (isPromise(value)) {
value.then(defer, defer.fail);
if (value === defer) {
throw new TypeError("promise and x refer to the same object");
} else {
value.then(defer, defer.fail);
}
} else {

@@ -291,10 +301,16 @@ defer(value);

});
this.onError(function () {
try {
if (typeof onError !== "function") {
if (typeof onRejected !== "function") {
defer.fail.apply(this, slice.call(arguments));
} else {
var value = onError.apply(this, slice.call(arguments));
var value = onRejected.apply(undefined, slice.call(arguments));
if (isPromise(value)) {
value.then(defer, defer.fail);
if (value === defer) {
throw new TypeError("promise and x refer to the same object");
} else {
value.then(defer, defer.fail);
}
} else {

@@ -308,2 +324,3 @@ defer(value);

});
return defer;

@@ -378,5 +395,5 @@ }

// console (in the browser)
setTimeout(function () {
setImmediate(function () {
handler && handler.apply(this.context || this, args);
}.bind(this), 0);
}.bind(this));
}

@@ -430,3 +447,5 @@

// begin executing steps next time we yield to event loop
setTimeout(function(){ superGroup._execNextStep(); }, 0);
setImmediate(function () {
superGroup._execNextStep();
});

@@ -433,0 +452,0 @@ return f;

{
"name": "ff",
"version": "0.2.0",
"description": "Concise, Powerful Asynchronous Flow Control in JavaScript",
"engine": [ "node >=0.2.0" ],
"author": "Marcus Cavanaugh <m@mcav.com>",
"version": "0.2.1",
"license": "MIT",
"description": "Concise, Powerful Asynchronous Flow Control in JavaScript.",
"keywords": ["async", "flow control"],
"homepage": "https://github.com/gameclosure/ff",
"bugs": "https://github.com/gameclosure/ff/issues",
"author": "Marcus Cavanaugh <m@mcav.com> (http://mcav.com)",
"contributors": [
"Michael Henretty <michael.henretty@gmail.com>",
"Teddy Cross <tkazec@gmail.com>"
"Teddy Cross <teddy@tkaz.ec> (http://tkaz.ec)"
],
"repository": {
"type" : "git",
"url" : "http://github.com/gameclosure/ff.git"
"main": "lib/ff",
"repository": "git://github.com/gameclosure/ff",
"scripts": {
"test": "mocha -R spec && promises-aplus-tests test/promise-adapter.js"
},
"devDependencies": {
"chai": "*",
"mocha": "*",
"promises-aplus-tests": "*"
"chai": "~1.9.1",
"mocha": "~1.21.4",
"promises-aplus-tests": "~1.3.2"
},
"scripts": {
"test": "mocha -R spec -t 5000 -s 1000 && promises-aplus-tests test/promise-adapter.js"
},
"main": "lib/ff"
"engines": {
"node": ">=0.6.0"
}
}

@@ -1,2 +0,2 @@

# <img src="http://f.cl.ly/items/3K113g321o0n0W0Y0Z33/Fast%20Forward%20Icon%20in%2032x32%20px.png" width=25 height=25> ff: Concise, Powerful Asynchronous JavaScript Flow Control [![Build Status](https://travis-ci.org/gameclosure/ff.png)](https://travis-ci.org/gameclosure/ff)
# <img src="http://f.cl.ly/items/3K113g321o0n0W0Y0Z33/Fast%20Forward%20Icon%20in%2032x32%20px.png" width="25" height="25"> ff: Concise, Powerful Asynchronous JavaScript Flow Control [![npm](https://img.shields.io/npm/v/ff.svg)](https://www.npmjs.org/package/ff) [![travis](https://img.shields.io/travis/gameclosure/ff.svg)](https://travis-ci.org/gameclosure/ff)

@@ -3,0 +3,0 @@ ***ff* simplifies the most common use cases for series, parallel, and

@@ -1,28 +0,15 @@

(function () {
if (typeof module !== "undefined") {
var ff = require("../lib/ff");
}
var ff = require("../lib/ff");
var adapter = {
pending: function () {
var f = ff.defer();
return {
promise: f,
fulfill: function (value) {
f(value);
},
reject: function (reason) {
f.fail(reason);
}
}
module.exports.pending = function () {
var f = ff.defer();
return {
promise: f,
fulfill: function (value) {
f(value);
},
reject: function (reason) {
f.fail(reason);
}
};
if (typeof module !== 'undefined') {
module.exports = adapter;
} else if (typeof exports !== 'undefined') {
exports = adapter; // jsio
} else {
this.adapter = adapter;
}
}());
};

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