Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

treeducer

jviide19MITdeprecated0.0.2TypeScript support: included

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

A self-balancing tree implementation w/ incremental reduction capabilities

typescript

readme

treeducer npm

Installation

$ npm install --save treeducer

Usage

import { Treeducer } from "treeducer";

let tree = new Treeducer({
  cmp(a: number, b: number) {
    return a - b;
  },
  map(a: number): number {
    return a;
  },
  reduce(a: number, b: number) {
    return a + b;
  }
});

tree = tree
  .insert(1)
  .insert(2)
  .insert(3)
  .delete(2);

tree.reduce(); // 4

License

This library is licensed under the MIT license. See LICENSE.