Socket
Socket
Sign inDemoInstall

find-item

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    find-item

A utility package to find an item that matches a condition from an array


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
3.98 kB
Created
Weekly downloads
 

Readme

Source

find-item

A utility package to find an item that matches a condition from an array.

Search Algorithms

find-item currently only supports 2 search algorithms:

Linear

Linear can be called like this: findItem.linear(array here, function to check if matches condition here, get all matches or the first, "all", "first"). If you choose the all option, it will return an array, which will contain the indexes of the values that match the condition. If no values are found, an empty array will be given. If you choose the first option, it will return a single number which is the index of the first value found. If no values are found, -1 will be returned.

Binary

Binary can be called like this: findItem.binary(array here, number here). This will return the index of location of the number. If it is not found, it will return -1.

Keywords

FAQs

Last updated on 25 Jul 2020

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