0.0.2 • Published 5 years ago

sortedmap v0.0.2

Weekly downloads
186
License
MPL-2.0
Repository
gitlab
Last release
5 years ago

SYNOPSIS

NPM Package Build Status Coverage Status

js-standard-style

INSTALL

npm install sortedmap

USAGE

const SortedMap = require('sortedmap')

const map = new SortedMap([
  ['a', 7],
  ['b', 1],
  ['c', 3]
], (a, b) => {
  return a - b
})

map.get('a') // 7

map.set('z', 6)
[...map] // [['b', 1], ['c', 3], ['z', 6], ['a', 7]]

API

constructor

index.js:11-27

Creates a sorted map with all the method and properties of a regular JS Map

Parameters

  • values Array<Array>? the intial values for the Map
  • compare Function A comparator function that takes two arguments and returns a number. The first argument will be a member of sortedArray, the second argument will be item. If item < member, return value < 0 If item > member, return value > 0

LICENSE

MPL-2.0

0.0.2

5 years ago

0.0.1

7 years ago

0.0.0

7 years ago