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

async-some

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-some - npm Package Compare versions

Comparing version 0.0.1 to 1.0.0

.eslintrc

10

package.json
{
"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
}
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