
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Runs a binary search on any sorted collection.
Requires Node.js 8.3.0 or above.
npm i bfind
The module exports a single function.
compare
(function, array, or any):
a
and b
, expected to return -1
if a
is less than b
, 1
if a
is greater than b
, and 0
if they are equal.get
(function): A callback that should return a value from the collection for a given index from 0
to length - 1
.length
(positive integer): The length of the collection.multiple
(string): Specifies behavior in the event that more than one existing collection item is sort-equivalent with value
.
first
or last
, the index of the first or last sort-equivalent item (respectively) will be returned.identical
, every sort-equivalent item will be scanned for identity (===
) with value
and the first identical item found will have its index returned.value
(any): The value to search for.Returns an object:
found
(boolean): true
if compare
reported that the collection contains another value with the same sort value as value
; false
otherwise.index
(positive integer): The index of value
or its sort-equivalent (if equal
is true
); or, the appropriate insertion index for value
(if equal
is false
).const bfind = require('bfind')
const arr = ['a', 'c', 'c']
const argsForArr = {get: i => arr[i], length: arr.length}
bfind({...argsForArr, value: 'a'}) // {found: true, index: 0}
bfind({...argsForArr, value: 'b'}) // {found: false, index: 1}
bfind({...argsForArr, value: 'c'}) // {found: true, index: 1}
bfind({...argsForArr, value: 'c', multiple: 'last'}) // {found: true, index: 2}
This module is part of the “b” family of binary search modules.
FAQs
Runs a binary search on any sorted collection.
The npm package bfind receives a total of 8 weekly downloads. As such, bfind popularity was classified as not popular.
We found that bfind 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.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.