Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eter

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eter

Lightweight collections for JavaScript

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

Eter

Build Status

Éter is a conglomerate of lightweight collections for JavaScript running on node and browser.

Usage

For node, install the package and include it

var eter = require('eter');

For the browser, just include the modules you want. You could use Bower to install the package

bower install eter --save

And include the script

<script src="path/to/eter/dist/eter.js"></script>

Types

If you use TypeScript, typings are included

import {Stack} from 'eter';

let s: Stack<number> = new Stack();

Collections

Stack

A Stack is a Last-In-First-Out (LIFO) data structure.

var s = new eter.Stack();

s.push(1);
s.push(2);
s.pop();//2
s.pop();//1
s.isEmpty();//true
s.pop();//Error "Empty stack"

Queue

A Queue is a First-In-First-Out (FIFO) data structure.

var q = new eter.Queue();

q.enqueue(1);
q.enqueue(2);
q.dequeue();//1
q.dequeue();//2
q.isEmpty();//true
q.dequeue();//Error "Empty queue"

LinkedList

A Linked List is a data structure consisting of a group of nodes which together represent a sequence.

var l = new eter.LinkedList();

l.add(1);
l.get(0);//1
l.remove(0);
l.isEmpty();//true
l.get(0);//Error "Index 0 out of bounds"

Trie

A Trie is an ordered tree data structure that is used to store a dynamic set or associative array where the keys are usually strings.

var t = new eter.Trie();

t.insert('one');
t.insert('oh');
t.insert('on');
t.contains('one');//true
t.insert('foo');
t.remove('foo');
t.contains('foo');//false

Hash Map

A Hash Map is a data structure used to implement an associative array, a structure that can map keys to values.

var m = new eter.HashMap();

m.put('key', 'value');
m.get('key');//value
m.contains('key');//true
m.remove('key');
m.contains('key');//false

Binary Tree

A Binary Tree is a data structure used for logarithmic search access.

var t = new eter.BinaryTree();

t.insert(10, 'value');
t.get(10);//value
t.remove(10);
t.get(10);//null

Keywords

FAQs

Package last updated on 13 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc