0.3.3 • Published 10 years ago

maps v0.3.3

Weekly downloads
233
License
ISC
Repository
github
Last release
10 years ago

NPM Version Build Status Coverage Status Downloads

maps

Some special Map implementations for ES6+

Install

npm install maps

Usage

import {HashMap} from 'maps'

class Entity {
	constructor(id) {
		this.id = id
	}
	[Symbol.for('hashCode')]() {
		return this.id
	}
	[Symbol.for('equals')](x) {
		return x instanceof Entity && x.id === this.id
	}
}

const m = new HashMap
const e1 = new Entity(42)
const e2 = new Entity(42)
const test = {}
assert(e1 !== e2)
m.set(e1, test)
assert(m.get(e2) === test)

API

Same as standard Map.

0.3.3

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.0

11 years ago