Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
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 2 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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.