Skip to content

jonschlinkert/last-index-of

Repository files navigation

last-index-of NPM version

Get the index of the last element in an array that returns truthy for the given value, using strict equality for comparisons.

Install with npm

npm i last-index-of --save

Usage

var lastIndexOf = require('last-index-of');

lastIndexOf(['a', 'b', 'c', 'a', 'b', 'c'], 'a');
//=> 3

lastIndexOf(['a', 'b', 'c'], 'd');
//=> -1

lastIndexOf(['a', 'b', 'a', 'b', 'a', 'b'], 'b', 3);
//=> 3

Run tests

npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert
Released under the MIT license


This file was generated by verb on December 12, 2014. To update, run npm i -g verb && verb.

About

Get the index of the last element in an array that returns truthy for the given value, using strict equality for comparisons.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published