diff --git a/lib/node_modules/@stdlib/array/fixed-endian-factory/README.md b/lib/node_modules/@stdlib/array/fixed-endian-factory/README.md index c1824d76f4f2..0cf3e6885543 100644 --- a/lib/node_modules/@stdlib/array/fixed-endian-factory/README.md +++ b/lib/node_modules/@stdlib/array/fixed-endian-factory/README.md @@ -908,6 +908,52 @@ var str = arr.join( 0 ); // returns '10203' ``` + + +#### TypedArray.prototype.findLast( predicate\[, thisArg] ) + +Returns the last element in an array for which a predicate function returns a truthy value. + +```javascript +var Float64ArrayFE = fixedEndianFactory( 'float64' ); +function predicate( element ) { + return element < 0; +} + +var arr = new Float64ArrayFE( 'little-endian', [ -1.0, 2.0, -4.0, 3.0 ] ); + +var res = arr.findLast( predicate ); +// returns -4.0 +``` + +The `predicate` function is provided three arguments: + +- **value**: current array element. +- **index**: current array element index. +- **arr**: the array on which this method was called. + +To set the function execution context, provide a `thisArg` + +```javascript +var Float64ArrayFE = fixedEndianFactory( 'float64' ); +function predicate( v ) { + this.count += 1; + return ( v < 0 ); +} + +var arr = new Float64ArrayFE( 'little-endian', [ -1.0, 2.0, 3.0 ] ); + +var context = { + 'count': 0 +}; + +var z = arr.findLast( predicate, context ); +// returns -1.0 + +var count = context.count; +// returns 3 +``` +