Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

spica

Package Overview
Dependencies
Maintainers
1
Versions
804
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spica - npm Package Compare versions

Comparing version 0.0.734 to 0.0.735

25

memoize.ts

@@ -19,7 +19,22 @@ import { isArray } from './alias';

if (typeof identify === 'object') return memoize(f, undefined, identify as Dict<b, z>);
return isArray(memory) || memory?.constructor === Object
? memoizeRecord(f, identify, memory as z[])
: memoizeDict(f, identify, memory as Dict<b, z> ?? new Map());
switch (true) {
case isArray(memory):
return memoizeArray(f, identify, memory as z[]);
case memory?.constructor === Object:
return memoizeObject(f, identify, memory as Record<number, z>);
default:
return memoizeDict(f, identify, memory as Dict<b, z> ?? new Map());
}
}
function memoizeRecord<as extends [unknown, ...unknown[]], z, b = as[0]>(f: (...as: as) => z, identify: (...as: as) => b, memory: Record<number, z>): typeof f {
function memoizeArray<as extends [unknown, ...unknown[]], z, b = as[0]>(f: (...as: as) => z, identify: (...as: as) => b, memory: z[]): typeof f {
return (...as) => {
const b = identify(...as) as number;
let z = memory[b];
if (z !== undefined) return z!;
z = f(...as);
memory[b] = z;
return z;
};
}
function memoizeObject<as extends [unknown, ...unknown[]], z, b = as[0]>(f: (...as: as) => z, identify: (...as: as) => b, memory: Record<number, z>): typeof f {
let nullable = false;

@@ -29,3 +44,3 @@ return (...as) => {

let z = memory[b];
if (z !== undefined || nullable && memory[b] !== undefined) return z!;
if (z !== undefined || nullable && b in memory) return z!;
z = f(...as);

@@ -32,0 +47,0 @@ nullable ||= z === undefined;

2

package.json
{
"name": "spica",
"version": "0.0.734",
"version": "0.0.735",
"description": "Supervisor, Coroutine, Channel, select, AtomicPromise, Cancellation, Cache, List, Queue, Stack, and some utils.",

@@ -5,0 +5,0 @@ "private": false,

@@ -19,7 +19,22 @@ import { isArray } from './alias';

if (typeof identify === 'object') return memoize(f, undefined, identify as Dict<b, z>);
return isArray(memory) || memory?.constructor === Object
? memoizeRecord(f, identify, memory as z[])
: memoizeDict(f, identify, memory as Dict<b, z> ?? new Map());
switch (true) {
case isArray(memory):
return memoizeArray(f, identify, memory as z[]);
case memory?.constructor === Object:
return memoizeObject(f, identify, memory as Record<number, z>);
default:
return memoizeDict(f, identify, memory as Dict<b, z> ?? new Map());
}
}
function memoizeRecord<as extends [unknown, ...unknown[]], z, b = as[0]>(f: (...as: as) => z, identify: (...as: as) => b, memory: Record<number, z>): typeof f {
function memoizeArray<as extends [unknown, ...unknown[]], z, b = as[0]>(f: (...as: as) => z, identify: (...as: as) => b, memory: z[]): typeof f {
return (...as) => {
const b = identify(...as) as number;
let z = memory[b];
if (z !== undefined) return z!;
z = f(...as);
memory[b] = z;
return z;
};
}
function memoizeObject<as extends [unknown, ...unknown[]], z, b = as[0]>(f: (...as: as) => z, identify: (...as: as) => b, memory: Record<number, z>): typeof f {
let nullable = false;

@@ -29,3 +44,3 @@ return (...as) => {

let z = memory[b];
if (z !== undefined || nullable && memory[b] !== undefined) return z!;
if (z !== undefined || nullable && b in memory) return z!;
z = f(...as);

@@ -32,0 +47,0 @@ nullable ||= z === undefined;

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