matrix-hash
Multidimensional implementation of hash for Node.js and browser with browserify.
Installation
$ npm install matrix-hash
Usage
var MatrixHash =var hash = 3hashdimension // 3hashsize // 0hashhashhashhashhashhashhashsize // 6hash // 'green'hash // truehash // false
API
constructor ([dim])
It creates a new instance of MatrixHash
based on dim
parameter that indicates the number of keys to access in hash value.
Time complexity: O(1)
dim
- Type: Number
- Default: 1
The dimension of matrix hash.
.dimension
- Type: Number
The property dimension of matrix hash.
Time complexity: O(1)
.size
- Type: Number
The size of the binary hash.
Time complexity: O(1)
.set(keys, value)
- Type: Function
- Returns: undefined
Adds a new element with specified keys
and value
to a MatrixHash object.
Time complexity: O(k) such that k === this.dimension
.get()
- Type: Function
- Returns: Element of instance of
MatrixHash
Returns a specified element from a MatrixHash object.
Time complexity: O(log(k)) such that k === this.dimension
.has(keys)
- Type: Function
- Returns: Boolean
Returns a boolean indicating whether an element with the specified keys
exists or not.
Time complexity: O(log(k)) such that k === this.dimension
FAQ
size
and not length?
Why do MatrixHash have the property I wanted to keep the ECMAScript 6 conventions.
Testing
$ npm test
Licence
MIT