1.10.0 • Published 9 years ago

tick-map v1.10.0

Weekly downloads
3
License
ISC
Repository
github
Last release
9 years ago

Tick Map

tick-map is a simple data structure in JavaScript for storing values in sorted, time-based buckets.

Build Status

The intention of tick-map is to allow easy, fast storage and retrieval of values using time-based keys. The key is specified only by a decimal value so it does not strictly have to represent time. The original intended usage is to store values for time ticks which are fractions of a second and allow retrieval of them using either the exact key or by the nearest rounded time tick; e.g. a second.

Usage

var TickMap = require('tick-map');

var tickMap = TickMap(); // Create a new TickMap

tickMap.add(3.000, "Event 1");
tickMap.add(3.142, "Event 2");
tickMap.add(4.900, "Event 3");
tickMap.add(1.421, "Event 4");

console.log(tickMap.get(3.000)); // => "Event 1"
console.log(tickMap.item(1)); // => "Event 1"
console.log(tickMap.item(0)); // => "Event 4" (Values are sorted on tick value)
console.log(tickMap.getBucketItems(3.000)); // => ["Event 1", "Event 2"]
1.10.0

9 years ago

1.8.0

10 years ago

1.7.1

10 years ago

1.7.0

10 years ago

1.6.2

10 years ago

1.6.1

10 years ago

1.6.0

10 years ago

1.5.0

10 years ago

1.4.0

10 years ago

1.3.0

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago