Gathering detailed insights and metrics for functional-red-black-tree2
Gathering detailed insights and metrics for functional-red-black-tree2
Gathering detailed insights and metrics for functional-red-black-tree2
Gathering detailed insights and metrics for functional-red-black-tree2
A purely functional red-black tree data structure
npm install functional-red-black-tree2
Typescript
Module System
Node Version
NPM Version
75.5
Supply Chain
85
Quality
75.3
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
5 Stars
110 Commits
1 Forks
1 Watchers
7 Branches
1 Contributors
Updated on Aug 16, 2022
Latest Version
1.1.0
Package Id
functional-red-black-tree2@1.1.0
Unpacked Size
169.13 kB
Size
26.84 kB
File Count
42
NPM Version
6.14.5
Node Version
12.18.2
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A fully persistent red-black tree rewritten in 100% TypeScript. Works both in node.js and in the browser via browserify.
Functional (or fully persistent) data structures allow for non-destructive updates. So if you insert an element into the tree, it returns a new tree with the inserted element rather than destructively updating the existing tree in place. Doing this requires using extra memory, and if one were naive it could cost as much as reallocating the entire tree. Instead, this data structure saves some memory by recycling references to previously allocated subtrees. This requires using only O(log(n)) additional memory per update instead of a full O(n) copy.
Some advantages of this is that it is possible to apply insertions and removals to the tree while still iterating over previous versions of the tree. Functional and persistent data structures can also be useful in many geometric algorithms like point location within triangulations or ray queries, and can be used to analyze the history of executing various algorithms. This added power though comes at a cost, since it is generally a bit slower to use a functional data structure than an imperative version. However, if your application needs this behavior then you may consider using this module.
npm install functional-red-black-tree2
Here is an example of some basic usage:
1//Load the library 2import {createRBTree as makeTree} from '../rbtree'; 3 4//Create a tree 5var tree1 = createTree(); 6 7//Insert some items into the tree 8var tree2 = tree1.insert(1, "foo"); 9var tree3 = tree2.insert(2, "bar"); 10 11//Remove something 12var tree4 = tree3.remove(1);
This repo is a fork of the functional-red-black-tree repository;
The idea is to provide the same functionality, but well-typed.
I did not change any logic with a few exceptions I can count by fingers on my one hand.
1.0.1 - Relese functional-red-black-tree2
(typed red-black-tree version)
1.1.0 - Updated documentation, version history. Linter added.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/5 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
15 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More