
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
namedtuplemap
Advanced tools
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.
npm install --save NamedTupleMap
This lib has no dependency, but requires a native implementation of Map.
var NamedTupleMap = require('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 = new NamedTupleMap({ 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.set({
oh: keyPart1,
my: keyPart2,
goodness: keyPart3
}, value);
cache.has({
oh: keyPart1,
my: keyPart2,
goodness: keyPart3
}) === true;
cache.get({
oh: keyPart1,
my: keyPart2,
goodness: keyPart3
}) === value;
MPL-2.0
FAQs
A Map which accepts a named tuple of objects as a key
We found that namedtuplemap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.