Skip to main content
Home

Built and signed on GitHub Actions

Function memoization with strong types.

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
5 months ago (0.4.0)

Memoization utilities.

To begin, import memoize function.

Examples

Example 1

import { memoize } from "./memoize.ts";

function sum(a: number, b: number): number {
  console.log("sum called");
  return a + b;
}

const memoizedSum = memoize(sum);

console.log(memoizedSum(1, 2)); // sum called, 3
console.log(memoizedSum(1, 2)); // 3
Built and signed on
GitHub Actions

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@mega/memoize

Import symbol

import * as memoize from "@mega/memoize";
or

Import directly with a jsr specifier

import * as memoize from "jsr:@mega/memoize";

Add Package

pnpm i jsr:@mega/memoize
or (using pnpm 10.8 or older)
pnpm dlx jsr add @mega/memoize

Import symbol

import * as memoize from "@mega/memoize";

Add Package

yarn add jsr:@mega/memoize
or (using Yarn 4.8 or older)
yarn dlx jsr add @mega/memoize

Import symbol

import * as memoize from "@mega/memoize";

Add Package

vlt install jsr:@mega/memoize

Import symbol

import * as memoize from "@mega/memoize";

Add Package

npx jsr add @mega/memoize

Import symbol

import * as memoize from "@mega/memoize";

Add Package

bunx jsr add @mega/memoize

Import symbol

import * as memoize from "@mega/memoize";