Comparing version 0.0.1 to 1.0.0
{ | ||
"name": "async-some", | ||
"version": "0.0.1", | ||
"version": "1.0.0", | ||
"description": "short-circuited, asynchronous version of Array.protototype.some", | ||
@@ -25,3 +25,9 @@ "main": "some.js", | ||
}, | ||
"homepage": "https://github.com/othiym23/async-some" | ||
"homepage": "https://github.com/othiym23/async-some", | ||
"dependencies": { | ||
"dezalgo": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"tap": "^0.4.11" | ||
} | ||
} |
30
some.js
@@ -0,1 +1,4 @@ | ||
var assert = require("assert") | ||
var dezalgoify = require("dezalgo") | ||
module.exports = some | ||
@@ -12,10 +15,16 @@ | ||
*/ | ||
function some (array, test, cb) { | ||
var index = 0 | ||
, length = array.length | ||
function some (list, test, cb) { | ||
assert("length" in list, "array must be arraylike") | ||
assert.equal(typeof test, "function", "predicate must be callable") | ||
assert.equal(typeof cb, "function", "callback must be callable") | ||
var array = slice(list) | ||
, index = 0 | ||
, length = array.length | ||
, hecomes = dezalgoify(cb) | ||
map() | ||
function map () { | ||
if (index >= length) return cb(null, false) | ||
if (index >= length) return hecomes(null, false) | ||
@@ -25,5 +34,5 @@ test(array[index], reduce) | ||
function reduce (er, value) { | ||
if (er) return cb(er, false) | ||
if (value) return cb(null, value) | ||
function reduce (er, result) { | ||
if (er) return hecomes(er, false) | ||
if (result) return hecomes(null, result) | ||
@@ -34,1 +43,8 @@ index++ | ||
} | ||
// Array.prototype.slice on arguments arraylike is expensive | ||
function slice(args) { | ||
var l = args.length, a = [], i | ||
for (i = 0; i < l; i++) a[i] = args[i] | ||
return a | ||
} |
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 README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7588
8
133
0
0
63
1
1
+ Addeddezalgo@^1.0.0
+ Addedasap@2.0.6(transitive)
+ Addeddezalgo@1.0.4(transitive)
+ Addedwrappy@1.0.2(transitive)