
Security News
npm v12 Ships With Install Scripts Off by Default, Begins Deprecating 2FA-Bypass Tokens
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.
array.prototype.findlast
Advanced tools
An ESnext spec-compliant `Array.prototype.findLast` shim/polyfill/replacement that works as far down as ES3.
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.
npm install --save array.prototype.findlast
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));
Simply clone the repo, npm install, and run npm test
Lodash is a popular utility library that includes a `findLast` method. This method is similar to array.prototype.findlast in that it searches an array from the end and returns the last element that passes a given test. The main difference is that lodash's `findLast` is a standalone function that takes the array as an argument, rather than being a method on the array prototype.
Underscore.js is another utility library that offers similar functionality through its `findLast` method. Like lodash, it provides this functionality as a part of a larger set of utilities for working with arrays, objects, and functions. The approach to finding the last element that meets a condition is similar, but underscore does not modify the array prototype.
FAQs
An ESnext spec-compliant `Array.prototype.findLast` shim/polyfill/replacement that works as far down as ES3.
The npm package array.prototype.findlast receives a total of 26,890,697 weekly downloads. As such, array.prototype.findlast popularity was classified as popular.
We found that array.prototype.findlast demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.

Research
/Security News
Socket tracks the activity as Operation “Muck and Load”: a threat actor uses commit-farming workflows, public dead drops, and protected archives to stage Windows RAT and infostealer malware.

Security News
pnpm 11.10 hardens registry auth to block token redirection, tightens pack-app and deploy, and makes the Rust port (v12) installable.