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.
avltree-js
Advanced tools
Supports all basic operations and custom sort comparison functions.
tree.insert(2);
tree.delete(2);
var element = tree.search(target);
returns the element if it exists.
var sum = 0;
tree.forEach(function (element) {
sum += element;
});
var min = tree.getMin();
var max = tree.getMax();
var max = tree.deleteMax();
var nodesAtZero = tree.getElementsAtDepth(0);
returns an array of elements at depth 0 (in this case, the root);
// Create a custom sorting function that will order people by age.
var personSortingFunction = function (personA, personB) {
if (personA.age < personB.age) {
return -1
} else if (personA.age > personB.age) {
return 1;
}
return 0;
};
// pass in the custom sorting function the the tree's constructor
var personTree = new AvlTree(personSortingFunction);
// create some test people to add to the tree
var person1 = { age: 1 };
var person2 = { age: 2 };
var person3 = { age: 3 };
var person4 = { age: 4 };
// add the people to the tree in any order
personTree.insert(person2);
personTree.insert(person1);
personTree.insert(person4);
personTree.insert(person3);
personTree.forEach(function (person) {
console.log(person.age);
});
output 1 2 3 4
Tests are run using mocha in the test directory.
npm install -g mocha
npm test
If you wish to help improve the speed there are some benchmarks in the speedTest directory.
npm run speedTest
does not support duplicate values at this time.
FAQs
Supports all basic operations and custom sort comparison functions.
The npm package avltree-js receives a total of 21 weekly downloads. As such, avltree-js popularity was classified as not popular.
We found that avltree-js 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
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.