JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q58923F
  • License MIT

Min/Max Heap

Package Exports

  • @amaui/heap
  • @amaui/heap/esm/index.js
  • @amaui/heap/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@amaui/heap) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme



AMAUI logo

AMAUI Heap

Min/Max Heap


MIT license     Production ready     UMD 2kb gzipped     100% test cov     Browser and Nodejs

Very simple code     Modern code     Junior friendly     Typescript     Made with 💛


Getting started

Add

  // yarn
  yarn add @amaui/heap

  // npm
  npm install @amaui/heap

Use

  import { AmauiHeap } from '@amaui/heap';

  // Make a new heap instance
  // with an optional initial value a variant (min or max)
  // a min heap as a default value
  const amauiMinHeap = new AmauiHeap();

  // Add a amaui node / value
  amauiMinHeap.add(4);

  // You can also make a heap from array of values
  amauiMinHeap.make([4, 44, 54, 14, 31, 37, 24]);

  // values
         4
        /  \
       /    \
     14      24
     / \     / \
   44   31 37   54

  // Remove priority min (first) value
  amauiMinHeap.remove();

  // 4

  // values
         14
        /  \
       /    \
     31      24
     / \     /
   44   54 37

Dev

Install

  yarn

Test

  yarn test

Prod

Build

  yarn build

Docs

Might be soon...