Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

p-memoize-cjs

owenallenaz21.5kISC7.1.0TypeScript support: included

Compilation of p-memoize to cjs to avoid needing to run ESM

readme

p-memoize-cjs

The upstream https://github.com/sindresorhus/p-memoize only functions if you run native ESM. Right now the toolchain is simply too experimental to update complicated workflows to ESM. Too many tools like ts-node, ts-node-dev, yarn just don't fully support ESM in a non-experimental way.

This library takes the export of p-memoize and just exports it as commonjs so you can import it in any Node project.

I wish this wasn't necessary.

usage

npm install p-memoize-cjs

Import syntax

// just pMemoize
import pMemoize from "p-memoize-cjs";

// other functions
import pMemoize, { pMemoizeClear, pMemoizeDecorator } from "p-memoize-cjs";

CJS

const { pMemoize, pMemoizeClear, pMemoizeDecorator } = "p-memoize-cjs";