Skip to content

compute find

kgryte edited this page May 12, 2015 · 1 revision

Finds array elements which satisfy a test condition.

var arr = [ 2, 1, 3, 4 ];

var opts = {
	'k': -2,
	'returns': '*'
};

function condition( val ) {
	return val < 4;
}

var results = compute.find( arr, opts, condition );
// returns [ [2,3], [1,1] ]

For further documentation, see the compute-find module.

Clone this wiki locally