array.prototype.findlast (1.2.5)
Published 2026-02-24 13:52:59 +00:00 by atheaadmin
Installation
registry=npm install array.prototype.findlast@1.2.5"array.prototype.findlast": "1.2.5"About this package
array.prototype.findlast 
An ESnext spec-compliant Array.prototype.findLast shim/polyfill/replacement that works as far down as ES3.
This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the proposed spec.
Because Array.prototype.findLast depends on a receiver (the this value), the main export takes the array to operate on as the first argument.
Getting started
npm install --save array.prototype.findlast
Usage/Examples
var findLast = require('array.prototype.findlast');
var assert = require('assert');
var arr = [1, [2], [], 3, [[4]]];
var isNumber = function (x) { return typeof x === 'number' };
assert.deepEqual(findLast(arr, isNumber), 3);
var findLast = require('array.prototype.findlast');
var assert = require('assert');
/* when Array#findLast is not present */
delete Array.prototype.findLast;
var shimmed = findLast.shim();
assert.equal(shimmed, findLast.getPolyfill());
assert.deepEqual(arr.findLast(isNumber), findLast(arr, isNumber));
var findLast = require('array.prototype.findlast');
var assert = require('assert');
/* when Array#findLast is present */
var shimmed = findLast.shim();
assert.equal(shimmed, Array.prototype.findLast);
assert.deepEqual(arr.findLast(isNumber), findLast(arr, isNumber));
Tests
Simply clone the repo, npm install, and run npm test
Dependencies
Dependencies
| ID | Version |
|---|---|
| call-bind | ^1.0.7 |
| define-properties | ^1.2.1 |
| es-abstract | ^1.23.2 |
| es-errors | ^1.3.0 |
| es-object-atoms | ^1.0.0 |
| es-shim-unscopables | ^1.0.2 |
Development Dependencies
| ID | Version |
|---|---|
| @es-shims/api | ^2.4.2 |
| @ljharb/eslint-config | ^21.1.0 |
| aud | ^2.0.4 |
| auto-changelog | ^2.4.0 |
| es-value-fixtures | ^1.4.2 |
| eslint | =8.8.0 |
| evalmd | ^0.0.19 |
| for-each | ^0.3.3 |
| globalthis | ^1.0.3 |
| has-strict-mode | ^1.0.1 |
| hasown | ^2.0.2 |
| in-publish | ^2.0.1 |
| npmignore | ^0.3.1 |
| nyc | ^10.3.2 |
| object-inspect | ^1.13.1 |
| safe-publish-latest | ^2.0.0 |
| tape | ^5.7.5 |
Keywords
Array.prototype.findLast
find
findLast
array
ESnext
shim
polyfill
last
es-shim API
