Arrays.findOne()

Search the array for the first dictionary that matches the specified criteria.

Usage

Hover over inputs/exits for more info.

var Arrays = require('machinepack-arrays');


// Search the array for the first dictionary that matches the specified criteria.

Arrays.findOne({

array: [ {} ],

criteria: {},

}).execSync();

Inputs

array required

The array to search in (i.e. "haystack")

[ {} ]
criteria required

The Lodash-style criteria to use (i.e. "metal detector")

{}

Exits

error

An unexpected error occurred.

notFound

Array does not contain an item matching the specified criteria.

success

OK.

(varies based on provided inputs)