Git Product home page Git Product logo

array.prototype.lastindexof's Introduction

array.prototype.lastindexof Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES2015 spec-compliant Array.prototype.lastindexof 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 spec.

Because Array.prototype.lastIndexOf depends on a receiver (the β€œthis” value), the main export takes the array to operate on as the first argument.

Example

var lastIndexOf = require('array.prototype.lastindexof');
var assert = require('assert');

assert.equal(lastIndexOf([1, 2, 3], 2), 1);
assert.equal(lastIndexOf([1, 0, 1], 1), 2);
assert.equal(lastIndexOf([1, 2, 3], 4), -1);
assert.equal(lastIndexOf([NaN], NaN), -1);
var lastIndexOf = require('array.prototype.lastindexof');
var assert = require('assert');
/* when Array#lastIndexOf is not present */
delete Array.prototype.lastIndexOf;
var shimmed = lastIndexOf.shim();
assert.equal(shimmed, lastIndexOf.getPolyfill());
assert.equal([1, 2, 3].lastIndexOf(2), 1);
assert.equal([1, 0, 1].lastIndexOf(1), 2);
assert.equal([1, 2, 3].lastIndexOf(4), -1);
assert.equal([NaN].lastIndexOf(NaN), -1);
var lastIndexOf = require('array.prototype.lastindexof');
var assert = require('assert');
/* when Array#lastIndexOf is present */
var shimmedMap = lastIndexOf.shim();
assert.equal(shimmedMap, Array.prototype.lastIndexOf);
assert.equal([1, 2, 3].lastIndexOf(2), 1);

Tests

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

array.prototype.lastindexof's People

Contributors

ljharb avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

isabella232

array.prototype.lastindexof's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: Cannot find preset's package (github>whitesource/merge-confidence:beta)

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm aud Unavailable

Pending Approval

These branches will be created by Renovate only once you click their checkbox below.

  • [Deps] Update Update eslint to v8.57.0
  • [Deps] Update Update aud to v3
  • [Deps] Update Update eslint to v9
  • [Deps] Update Update nyc to v17
  • πŸ” Create all pending approval PRs at once πŸ”

Detected dependencies

github-actions
.github/workflows/node-aught.yml
.github/workflows/node-pretest.yml
.github/workflows/node-tens.yml
.github/workflows/rebase.yml
.github/workflows/require-allow-edits.yml
npm
package.json
  • call-bind ^1.0.7
  • define-properties ^1.2.1
  • es-abstract ^1.23.2
  • es-object-atoms ^1.0.0
  • is-negative-zero ^2.0.3
  • is-string ^1.0.7
  • @es-shims/api ^2.4.2
  • @ljharb/eslint-config ^21.1.0
  • aud ^2.0.4
  • auto-changelog ^2.4.0
  • eslint =8.8.0
  • evalmd ^0.0.19
  • functions-have-names ^1.2.3
  • has-strict-mode ^1.0.1
  • in-publish ^2.0.1
  • npmignore ^0.3.1
  • nyc ^10.3.2
  • safe-publish-latest ^2.0.0
  • tape ^5.7.5
  • node >= 0.4

  • Check this box to trigger a request for Renovate to run again on this repository

An in-range update of auto-changelog is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency auto-changelog was updated from 1.16.2 to 1.16.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

auto-changelog is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details

Commits

The new version differs by 4 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of es-abstract is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The dependency es-abstract was updated from 1.17.4 to 1.17.5.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

es-abstract is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details

Commits

The new version differs by 5 commits.

  • 3641bbb v1.17.5
  • bdd77b5 [Fix] CreateDataProperty: update an existing property
  • 920a682 [Dev Deps] update make-arrow-function, tape
  • b9069ac [Fix] run missing spackle from cd7504701879ddea0f5981e99cbcf93bfea9171d
  • 9f1690f [Dev Deps] update @ljharb/eslint-config

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.