Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
cache-mapset
Advanced tools
Maps and Sets with cache replacement policies, TC39 proposal-policy-map-set implementation
Maps and Sets with cache replacement policies, TC39 proposal-policy-map-set implementation. This can be used as a cache for TC39 proposal-function-memo and its implementation.
FIFO(First In, First Out) implementations.
When the upper limit is reached, replaces the entry with FIFO algorithm.
import { FIFOMap } from "https://deno.land/x/cache_mapset@$VERSION/mod.ts";
declare const maxNumOfEntries: number;
const map = new FIFOMap(maxNumOfEntries);
When the upper limit is reached, replaces the value with FIFO algorithm.
import { FIFOSet } from "https://deno.land/x/cache_mapset@$VERSION/mod.ts";
declare const maxNumOfValues: number;
const set = new FIFOSet(maxNumOfValues);
LIFO(Last In, First Out) implementations.
When the upper limit is reached, replaces the entry with LIFO algorithm.
import { LIFOMap } from "https://deno.land/x/cache_mapset@$VERSION/mod.ts";
declare const maxNumOfEntries: number;
const map = new LIFOMap(maxNumOfEntries);
When the upper limit is reached, replaces the value with LIFO algorithm.
import { LIFOSet } from "https://deno.land/x/cache_mapset@$VERSION/mod.ts";
declare const maxNumOfValues: number;
const set = new LIFOSet(maxNumOfValues);
LRU(Least Recently Used) implementations.
When the upper limit is reached, replaces the entry with LRU algorithm.
import { LRUMap } from "https://deno.land/x/cache_mapset@$VERSION/mod.ts";
declare const maxNumOfEntries: number;
const map = new LRUMap(maxNumOfEntries);
When the upper limit is reached, replaces the value with LRU algorithm.
import { LRUSet } from "https://deno.land/x/cache_mapset@$VERSION/mod.ts";
declare const maxNumOfValues: number;
const set = new LRUSet(maxNumOfValues);
LFU(Least Frequently Used) implementations.
When the upper limit is reached, replaces the entry with LFU algorithm.
import { LFUMap } from "https://deno.land/x/cache_mapset@$VERSION/mod.ts";
declare const maxNumOfEntries: number;
const map = new LFUMap(maxNumOfEntries);
When the upper limit is reached, replaces the value with LFU algorithm.
import { LFUSet } from "https://deno.land/x/cache_mapset@$VERSION/mod.ts";
declare const maxNumOfValues: number;
const set = new LFUSet(maxNumOfValues);
List items common to all implementations.
All instance have following members.
MapLike:
interface MapLike<K, V> {
/** The number of entries. */
size: number;
/** Whether has an entry with the given {@link key}. */
has: (key: K) => boolean;
/** Returns the value of the entry with the given {@link key}, if any such entry exists; otherwise returns `undefined`. */
get: (key: K) => V | undefined;
/** Adds an entry with the given {@link key} mapped to the given {@link value}. */
set: (key: K, value: V) => this;
/** Deletes the entry with the given {@link key}. */
delete: (key: K) => boolean;
/** Removes all entries. */
clear: () => void;
}
SetLike:
interface SetLike<T> {
/** The number of values. */
size: number;
/** Whether has the given {@link value}. */
has: (value: T) => boolean;
/** Adds the given {@link value}. */
add: (value: T) => this;
/** Deletes the given {@link value}. */
delete: (value: T) => boolean;
/** Removes all values. */
clear: () => void;
}
All constructors specify a capacity as their first argument.
If it is a negative number, an error is thrown.
import { FIFOMap } from "https://deno.land/x/cache_mapset@$VERSION/mod.ts";
import { assertThrows } from "https://deno.land/std/testing/asserts.ts";
assertThrows(() => new FIFOMap(-1));
See deno doc for all APIs.
See CONTRIBUTING.md
MIT © 2023 Tomoki Miyauchi
1.0.0-beta.2 (2023-06-18)
FAQs
Maps and Sets with cache replacement policies, TC39 proposal-policy-map-set implementation
The npm package cache-mapset receives a total of 5 weekly downloads. As such, cache-mapset popularity was classified as not popular.
We found that cache-mapset 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.