Skip to main content

@hqtsm/meek@1.0.5
Built and signed on GitHub Actions

Weak data collections without the limitations

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
3 months ago (1.0.5)

HQTSM: Meek

Weak data collections without the limitations

weakset weakmap weakvaluemap enumerable iterable collection

JSR npm CI

Features

  • Pure TypeScript, run anywhere
  • Enumerable WeakSet: MeekSet
  • Enumerable WeakMap: MeekMap
  • WeakValueMap: MeekValueMap
  • Designed to be as compatible with the native collection types as possible
  • Do almost anything you can with regular collections with weak collections

Usage

MeekSet

import { MeekSet } from '@hqtsm/meek';

const values = [{ a: 1 }, { b: 2 }, { c: 3 }];
const set = new MeekSet(values);
console.assert(JSON.stringify([...set]) === JSON.stringify(values));

MeekMap

import { MeekMap } from '@hqtsm/meek';

const values: [{ i: number }, number][] = [
	[{ i: 0 }, 1],
	[{ i: 1 }, 2],
	[{ i: 2 }, 3],
];
const map = new MeekMap(values);
console.assert(JSON.stringify([...map]) === JSON.stringify(values));

MeekValueMap

import { MeekValueMap } from '@hqtsm/meek';

const values: [number, { i: number }][] = [
	[1, { i: 0 }],
	[2, { i: 1 }],
	[3, { i: 2 }],
];
const map = new MeekValueMap(values);
console.assert(JSON.stringify([...map]) === JSON.stringify(values));
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add jsr:@hqtsm/meek

Import symbol

import * as meek from "@hqtsm/meek";

---- OR ----

Import directly with a jsr specifier

import * as meek from "jsr:@hqtsm/meek";

Add Package

npx jsr add @hqtsm/meek

Import symbol

import * as meek from "@hqtsm/meek";

Add Package

yarn dlx jsr add @hqtsm/meek

Import symbol

import * as meek from "@hqtsm/meek";

Add Package

pnpm dlx jsr add @hqtsm/meek

Import symbol

import * as meek from "@hqtsm/meek";

Add Package

bunx jsr add @hqtsm/meek

Import symbol

import * as meek from "@hqtsm/meek";