Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@x-oasis/prefix-interval-tree
Advanced tools
$ npm i @x-oasis/prefix-interval-tree
import PrefixIntervalTree from '@x-oasis/prefix-interval-tree'
$ pnpm test
const intervalTree = new PrefixIntervalTree([2,5,7])
const intervalTree = new PrefixIntervalTree(10)
Total interval tree array length is power of 2
, such as 8, 16, 32; and the input length value means the half size, which means 10
will result in 2^4 = 16
first, then patch on interval tree, it will be total 2 * 16 = 32
.
getHeap(): number[]
Basically, interval tree's size is this._half, they all have default 0
value. when you want to get the actual size which has been set with value, then call this method.
get(index: number): number
get the index value
set (index: number): boolean
To update the index value in interval tree, its parent will be updated as accordingly.
computeRange(minValue: number, maxValue: number): {
startIndex: number
endIndex: number
}
startIndex
: the biggest index less than or equal minValue;endIndex
: the smallest index greater than maxValue;when using the return value, endIndex item should not be included.
const arr = []
const intervalTree = new PrefixIntervalTree(arr)
const { startIndex, endIndex } = intervalTree.computeRange(100, 200);
const itemsInViewport = arr.slice(startIndex, endIndex)
FAQs
prefix interval tree function
The npm package @x-oasis/prefix-interval-tree receives a total of 488 weekly downloads. As such, @x-oasis/prefix-interval-tree popularity was classified as not popular.
We found that @x-oasis/prefix-interval-tree demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.