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

Package detail

array.prototype.findlast

es-shims36.4mMIT1.2.5

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

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

readme

array.prototype.findlast Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

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

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.5 - 2024-03-19

Commits

  • [meta] remove useless ESM 30b3843
  • [Deps] update call-bind, es-abstract f339e4d
  • [actions] remove redundant finisher 3b66016
  • [Refactor] use es-object-atoms where possible c7146f1
  • [Dev Deps] update hasown, tape 16149a0

v1.2.4 - 2024-02-05

Commits

  • [Deps] update call-bind, define-properties, es-abstract, es-shim-unscopables, get-intrinsic 6960289
  • [Refactor] use es-errors, so things that only need those do not need get-intrinsic 96e976a
  • [Dev Deps] update aud, npmignore, tape e41c671
  • [Dev Deps] use hasown instead of has 3e81897
  • [Dev Deps] update object-inspect, tape 09387d9

v1.2.3 - 2023-08-29

Commits

  • [Deps] update define-properties, es-abstract, get-intrinsic ed6e699
  • [Tests] add passing test262 test ba57e7f
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, aud, object-inspect, tape fdf9269
  • [Tests] use globalthis d56fd28

v1.2.2 - 2022-11-02

Commits

  • [meta] use npmignore to autogenerate an npmignore file c8bd8e9
  • [Deps] update es-abstract, get-intrinsic 7dd1e37
  • [actions] update rebase action to use reusable workflow 116bfa3
  • [Deps] update define-properties, es-abstract, get-intrinsic 8a6fcb5
  • [Dev Deps] update es-value-fixtures, object-inspect, tape 899e29a
  • [Dev Deps] update aud, tape 2019883
  • [Tests] add indication of whether it was shimmed c940767

v1.2.1 - 2022-04-11

Commits

  • [Refactor] use es-shim-unscopables e85dfc7

v1.2.0 - 2022-04-11

Commits

  • [actions] reuse common workflows 47e3be7
  • [Dev Deps] update eslint, @ljharb/eslint-config, object-inspect, safe-publish-latest, tape da9ec92
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, object-inspect, tape 2658604
  • [actions] update codecov uploader 9e4ac5e
  • [New] shim/auto: add findLast to Symbol.unscopables a3703b0
  • [meta] use prepublishOnly script for npm 7+ 499fd61
  • [Deps] update es-abstract 9833a38
  • [Deps] update es-abstract 3055ac5
  • [Dev Deps] update @es-shims/api 4639a6b

v1.1.1 - 2021-10-01

Commits

  • [Refactor] remove ESM entry points 10118cc
  • [Tests] add new tests from test262 11a6b0a
  • [Deps] update es-abstract ad74212
  • [readme] fix URLs ea7f11e
  • [Dev Deps] update @ljharb/eslint-config, @es-shims/api b834c11

v1.1.0 - 2021-08-07

Commits

  • [New] add ESM entry points 4830a17
  • [Fix] ES3 engines: ensure nullish receiver throws 3483d48
  • [Fix] add missing entry points to exports db8fe56
  • [Dev Deps] update eslint, tape a59f069
  • [Deps] update es-abstract 4faa274

v1.0.0 - 2021-07-13

Commits