Socket
Socket
Sign inDemoInstall

index-of

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    index-of

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


Version published
Maintainers
1
Install size
5.17 kB
Created

Readme

Source

index-of NPM version

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

Install

Install with npm

$ npm i index-of --save

Install with bower

$ bower install index-of --save

Usage

var indexOf = require('index-of');

indexOf(['a', 'b', 'c'], 'b');
//=> 1

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

indexOf(['a', 'b', 'c', 'a', 'b', 'c'], 'b', 2);
//=> 4

Other object utils:

  • array-every: Returns true if the callback returns truthy for all elements in the given array.
  • array-slice: Array-slice method. Slices array from the start index up to, but not including, the endmore
  • array-unique: Return an array free of duplicate values. Fastest ES5 implementation.
  • filter-array: Iterates over the elements in an array, returning an array with only the elements for… more

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

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

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on June 22, 2015.

Keywords

FAQs

Last updated on 23 Jun 2015

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc