.first() - DarthJDG/Mangler.js GitHub Wiki

Returns the first item that passes the test.

.first([test])
Parameter Type Default Description
test Test {} The test expression to check against.

Returns

Returns the first item that passes the test.


If called without a test parameter, it returns the first item of the .items[ ] array. For more information on test expressions, see Mangler.test().

Example

m = Mangler([1, 2, 3, 4]);

m.first();              // Returns 1
m.first({ $gt: 2 });    // Returns 3
⚠️ **GitHub.com Fallback** ⚠️