Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

This is an extension of Immutable.js that provides sorted collections SortedMap and SortedSet. The current implementation is using highly optimized B-tree memory structure.

License

Notifications You must be signed in to change notification settings

youfoundron/immutable-sorted

 
 

Repository files navigation

Immutable Sorted Collections for JavaScript

This package is an extension of Immutable.js which provides additional Persistent Immutable data structures SortedMap and SortedSet.

These data structures are highly efficient minimizing the need to copy or cache data by structural sharing via B-trees.

Installation

npm install immutable-sorted

Examples

SortedSet (see more examples on SortedSet page):

> const { SortedSet } = require('immutable-sorted');

> const set1=SortedSet(['orange', 'apple', 'banana']);
SortedSet { "apple", "banana", "orange" }

> const set2=set1.add('mango');
SortedSet { "apple", "banana", "mango", "orange" }

> const set3=set2.delete('banana');
SortedSet { "apple", "mango", "orange" }

SortedMap (see more examples on SortedMap page):

const { SortedMap, isSorted } = require('immutable-sorted');

> const map1=SortedMap([['orange','orange'], ['apple','red'], ['banana','yellow']]);
SortedMap { "apple": "red", "banana": "yellow", "orange": "orange" }

> const map2=map1.set('mango', 'yellow/orange');
SortedMap { "apple": "red", "banana": "yellow", "mango": "yellow/orange", "orange": "orange" }

> const map3=map2.delete('banana');
SortedMap { "apple": "red", "mango": "yellow/orange", "orange": "orange" }

License

Modified work (Immutable Sorted collections) is MIT Licensed.

Original work (Immutable.js) is BSD-licensed and additional patent grant is provided.

About

This is an extension of Immutable.js that provides sorted collections SortedMap and SortedSet. The current implementation is using highly optimized B-tree memory structure.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 68.1%
  • TypeScript 28.7%
  • CSS 2.5%
  • Other 0.7%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.