Comparing version 1.0.1 to 1.1.1
/** | ||
* Initializes breeze class | ||
* Breeze Constructor | ||
* | ||
* Accepts a then method as the first argument. | ||
* | ||
* @param {Function} method initialization method, optional. | ||
*/ | ||
function Breeze () { | ||
function Breeze (method) { | ||
this.steps = [] | ||
if (typeof method === 'function') { | ||
this.then(method) | ||
} | ||
} | ||
@@ -93,3 +101,3 @@ | ||
Breeze.prototype.when = Breeze.prototype.maybe = function _breezeMaybeWhen (arg, next) { | ||
if (arg) { | ||
if ((typeof arg === 'function' && arg.apply(this.context, this.args || [])) || arg) { | ||
this.hasMaybeHappened = true | ||
@@ -114,3 +122,3 @@ this.steps.push(next) | ||
if (arg && !this.hasNoneHappened) { | ||
if (!this.hasNoneHappened && ((typeof arg === 'function' && arg.apply(this.context, this.args || [])) || arg)) { | ||
this.hasSomeHappened = true | ||
@@ -137,3 +145,3 @@ this.steps.push(next) | ||
if (!this.hasSome) { | ||
throw new Error("Cannot add none callback before some callback") | ||
throw new Error("Cannot add .none check before adding .some checks") | ||
} | ||
@@ -193,4 +201,4 @@ | ||
*/ | ||
module.exports = function breeze () { | ||
return new Breeze() | ||
module.exports = function breeze (method) { | ||
return new Breeze(method) | ||
} |
{ | ||
"name": "breeze", | ||
"version": "1.0.1", | ||
"version": "1.1.1", | ||
"description": "Functional async flow control library", | ||
"main": "breeze.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "node test/index.js" | ||
}, | ||
@@ -21,3 +21,7 @@ "repository": { | ||
"try", | ||
"catch" | ||
"catch", | ||
"promises", | ||
"thennable", | ||
"bluebird", | ||
"q" | ||
], | ||
@@ -29,3 +33,6 @@ "author": "Nijiko Yonskai", | ||
}, | ||
"homepage": "https://github.com/Nijikokun/breeze#readme" | ||
"homepage": "https://github.com/Nijikokun/breeze#readme", | ||
"devDependencies": { | ||
"tess": "^1.0.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
11786
6
297
0
1