Skip to content

☆ Basic high-level data structure library for Node.js

License

Notifications You must be signed in to change notification settings

rickyes/lucky.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lucky.js

Basic high-level data structure library for Node.js, inspired by Java

Travis Node Version npm Codecov

Install

$ npm i lucky.js --save

Features

  • LinkedList 链表
  • HashMap 哈希
  • RedBlackTree 红黑树
  • MinimumHeap 最小堆
  • AVLTree
  • BTree B+树

API

See the detailed API Reference.

Example

'use strict';

const {LinkedList, HashMap} = require('lucky.js');
const linkedList = new LinkedList();
const hashMap = new HashMap();

// LinkedList
linkedList.add('one');
linkedList.add('two');
const topValue = linkedList.peek(); // one


// HashMap
hashmap.put('one', 1);
const value = hashmap.get('one'); // 1
const oldValue = hashmap.replace('one', 1); // null

Author

Lucky.js © Ricky 泽阳, Released under the MIT License.