ArraySome

This function calls a given closure/function with every element in a given array and returns true, if one of the closure calls returns true.

Returns: boolean

Usage

ArraySome( array, closure [, parallel [, maxThreads ] ] )

Arguments

Argument Description Default
array
(array, required)

array to iterate

closure
(function, required)

function/closure that implements the following constructor [function(any value[, numeric index,array array]):boolean].

parallel
(boolean, optional)

execute closures parallel

maxThreads
(number, optional)

maximum number of threads executed, ignored when argument "parallel" is set to false

20

Examples

uses a closure to determine if an item or expression exists

newArray = ['a','b','c','b','d','b','e','f'];
	dump(newArray);
	
	hasSome1 = arraySome(newArray,function(item,idx,arr){ 
	    return item == 'b';
	});
	dump(hasSome1);
	
    // member function
	hasSome2 = newArray.some(function(item,idx,arr){ 
	    return item == 'k';
	});
	dump(hasSome2);

See also