Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

array.prototype.findlastindex

es-shims79.8mMIT1.2.6

An ESnext spec-compliant Array.prototype.findLastIndex shim/polyfill/replacement that works as far down as ES3.

Array.prototype.findLastIndex, find, findLast, findLastIndex, array, ESnext, shim, polyfill, last, es-shim API

readme

array.prototype.findlastindex Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ESnext spec-compliant Array.prototype.findLastIndex 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.findLastIndex 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.findlastindex

Usage/Examples

var findLastIndex = require('array.prototype.findlastindex');
var assert = require('assert');

var arr = [1, [2], [], 3, [[4]]];
var isNumber = function (x) { return typeof x === 'number' };

assert.deepEqual(findLastIndex(arr, isNumber), 3);
var findLastIndex = require('array.prototype.findlastindex');
var assert = require('assert');
/* when Array#findLastIndex is not present */
delete Array.prototype.findLastIndex;
var shimmed = findLastIndex.shim();

assert.equal(shimmed, findLastIndex.getPolyfill());
assert.deepEqual(arr.findLastIndex(isNumber), findLastIndex(arr, isNumber));
var findLastIndex = require('array.prototype.findlastindex');
var assert = require('assert');
/* when Array#findLastIndex is present */
var shimmed = findLastIndex.shim();

assert.equal(shimmed, Array.prototype.findLastIndex);
assert.deepEqual(arr.findLastIndex(isNumber), findLastIndex(arr, isNumber));

Tests

Simply clone the repo, npm install, and run npm test

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.2.6 - 2025-03-14

Commits

  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, auto-changelog, es-value-fixtures, for-each, globalthis, has-strict-mode, object-inspect, tape 2012a88
  • [Deps] update call-bind, es-abstract, es-object-atoms, es-shim-unscopables 1c9fd19
  • [Refactor] use call-bound directly 78722d3
  • [Tests] replace aud with npm audit cb689c1
  • [Dev Deps] add missing peer dep d3c92c4

v1.2.5 - 2024-03-19

Commits

  • [meta] remove useless ESM 4ed36ab
  • [Deps] update call-bind, es-abstract a6e3816
  • [Refactor] use es-object-atoms where possible 3fbee9b
  • [Dev Deps] update hasown, tape dc6356c

v1.2.4 - 2024-02-05

Commits

  • [Deps] update call-bind, define-properties, es-abstract, es-shim-unscopables, get-intrinsic b689455
  • [Refactor] use es-errors, so things that only need those do not need get-intrinsic ca636e6
  • [Tests] use functions-have-names b91692c
  • [Dev Deps] update aud, npmignore, tape 4f87dff
  • [Dev Deps] use hasown instead of has 57ce292
  • [Dev Deps] update object-inspect, tape fa74bab

v1.2.3 - 2023-08-29

Commits

  • [Deps] update define-properties, es-abstract, get-intrinsic 27e8133
  • [Tests] add passing test262 test 678edb3
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, aud, object-inspect, tape 47abe8b
  • [Tests] use globalthis 0cf9142

v1.2.2 - 2022-11-02

Commits

  • [meta] use npmignore to autogenerate an npmignore file f910dc6
  • [Deps] update es-abstract, get-intrinsic 6e44207
  • [actions] update rebase action to use reusable workflow aac0471
  • [Deps] update define-properties, es-abstract, get-intrinsic c1d1d70
  • [Dev Deps] update es-value-fixtures, object-inspect, tape 64c4c0f
  • [Dev Deps] update aud, tape 603fbac
  • [Tests] add indication of whether it was shimmed 7d711f6
  • [Tests] make nullish receiver tests more robust 335cf53

v1.2.1 - 2022-04-11

Commits

  • [Refactor] use es-shim-unscopables abe84ee

v1.2.0 - 2022-04-11

Commits

  • [actions] reuse common workflows 670cc4c
  • [Dev Deps] update eslint, @ljharb/eslint-config, @es-shims/api, object-inspect, safe-publish-latest, tape 11bc460
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, object-inspect, tape b076ad6
  • [actions] update codecov uploader 0d62d86
  • [New] shim/auto: add findLast to Symbol.unscopables b09e4a6
  • [Deps] update es-abstract 024128c
  • [Deps] update es-abstract 2dcab99

v1.1.1 - 2021-10-01

Commits

  • [Refactor] remove unnecessary ESM files 35161c7
  • [Tests] add new tests from test262 e26fa25
  • [Deps] update es-abstract 5ff80b1
  • [readme] fix URLs b962fe2
  • [Dev Deps] update @ljharb/eslint-config, @es-shims/api 5aa11dd

v1.1.0 - 2021-08-07

Commits

  • [New] add ESM entry points ac5ada3
  • [Fix] ES3 engines: ensure nullish receiver throws 4c6592a
  • [Dev Deps] update eslint, @tape 6895166
  • [Fix] add missing entry points to exports ac2f138
  • [Deps] update es-abstract c379fb7

v1.0.0 - 2021-07-13

Commits