Socket
Socket
Sign inDemoInstall

@thi.ng/memoize

Package Overview
Dependencies
Maintainers
1
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/memoize - npm Package Compare versions

Comparing version 3.1.61 to 3.1.62

2

CHANGELOG.md
# Change Log
- **Last updated**: 2024-03-01T15:22:50Z
- **Last updated**: 2024-03-02T14:05:53Z
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)

@@ -5,0 +5,0 @@

{
"name": "@thi.ng/memoize",
"version": "3.1.61",
"version": "3.1.62",
"description": "Function memoization with configurable caching",

@@ -92,3 +92,3 @@ "type": "module",

},
"gitHead": "d660ae8fd1bf64d919b4334f19509f1f539d70f6\n"
"gitHead": "df9e312af741d87e6b450afcfea6a6e381662b1e\n"
}

@@ -108,3 +108,6 @@ <!-- This file is generated - DO NOT EDIT! -->

```ts
foo = m.memoize1((x) => (console.log("exec"), x * 10));
import { memoize1 } from "@thi.ng/memoize";
foo = memoize1((x) => (console.log("exec"), x * 10));
foo(1);

@@ -116,5 +119,8 @@ // exec

import { EquivMap } from "@thi.ng/associative";
// with custom cache
foo = m.memoize1(
foo = memoize1(
(x) => (console.log("exec"), x[0] * 10),
// custom ES6 Map impl which compares by value, not by reference
new EquivMap()

@@ -126,7 +132,11 @@ );

// 10
foo([1]); // wouldn't work w/ native ES6 Map as cache
// would be a cache miss w/ native ES6 Map
foo([1]);
// 10
import { LRUCache } from "@thi.ng/cache";
// use LRU cache to limit cache size
foo = m.memoize1(
foo = memoize1(
(x) => (console.log("exec"), x[0] * 10),

@@ -140,3 +150,6 @@ new LRUCache(null, { maxlen: 3 })

```ts
dotProduct = m.memoize(
import { memoize } from "@thi.ng/memoize";
import { EquivMap } from "@thi.ng/associative";
const dotProduct = memoize(
(x, y) => (console.log("exec"), x[0] * y[0] + x[1] * y[1]),

@@ -156,9 +169,11 @@ new EquivMap()

```ts
dotProduct = m.memoizeJ(
import { memoizeJ } from "@thi.ng/memoize";
const dotProduct = memoizeJ(
(x, y) => (console.log("exec"), x[0] * y[0] + x[1] * y[1])
);
dotProduct([1,2], [3,4]);
dotProduct([1, 2], [3, 4]);
// exec
// 11
dotProduct([1,2], [3,4]);
dotProduct([1, 2], [3, 4]);
// 11

@@ -165,0 +180,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc