Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
@thi.ng/arrays
Advanced tools
This project is part of the @thi.ng/umbrella monorepo.
Array / Arraylike utilities.
STABLE - used in production
Search or submit any issues for this package
yarn add @thi.ng/arrays
ES module import:
<script type="module" src="https://cdn.skypack.dev/@thi.ng/arrays"></script>
For Node.js REPL:
const arrays = await import("@thi.ng/arrays");
Package sizes (brotli'd, pre-treeshake): ESM: 2.61 KB
The following predicates can be used to perform predecessor / successor
queries using binarySearch()
.
bsLT()
- Returns index of last item less than search value or -1 if
no such values existbsLE()
- Similar to bsLT()
, but for less-than-equals queriesbsGT()
- Returns index of first item greater than search value or -1
if no such values existbsGE()
- Similar to bsGT()
, but for less-than-equals queriesbsEQ()
- Merely syntax sugar, casting any non-found result indices to -1const src = [10, 20, 30, 40];
bsLT(binarySearch(src, 25))
// 1
// greater-than queries also require the array length
bsGT(binarySearch(src, 25), src.length)
// 2
bsGT(binarySearch(src, 40), src.length)
// -1
If this project contributes to an academic publication, please cite it as:
@misc{thing-arrays,
title = "@thi.ng/arrays",
author = "Karsten Schmidt",
note = "https://thi.ng/arrays",
year = 2018
}
© 2018 - 2023 Karsten Schmidt // Apache License 2.0
FAQs
Array / Arraylike utilities
The npm package @thi.ng/arrays receives a total of 124,951 weekly downloads. As such, @thi.ng/arrays popularity was classified as popular.
We found that @thi.ng/arrays demonstrated a healthy version release cadence and project activity because the last version was released less than 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
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.