NamedTupleMap
A Map which accepts a named tuple as a key. This lib is one of the several possible cache for memoize-immutable, but it can suit other use-cases as it implements a usual Map API.
Install
npm install --save NamedTupleMap
This lib has no dependency, but requires a native implementation of Map.
Usage
var NamedTupleMap = ; // When the `limit` option is set, NamedTupleMap turns into an LRU cache.// Clearing the map every X seconds can also be an acceptable strategy sometimes.var cache = limit: 10000 ; var keyPart1 = {};var keyPart2 = 'yolo';var keyPart3 = ;var value = any: 'thing'; // Note that following named tuples are wrapped in new objects that are !==// (otherwise a Map would have been enough).cache; cache === true;cache === value;
Author
License
MPL-2.0