REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.58 KB
Close
/home/byroehnu/easepay.easetack.com/node_modules/memoize-one/src/memoize-one.ts
Text
Base64
import areInputsEqual from './are-inputs-equal'; export type EqualityFn<TFunc extends (...args: any[]) => any> = ( newArgs: Parameters<TFunc>, lastArgs: Parameters<TFunc>, ) => boolean; export type MemoizedFn<TFunc extends (this: any, ...args: any[]) => any> = { clear: () => void; (this: ThisParameterType<TFunc>, ...args: Parameters<TFunc>): ReturnType<TFunc>; }; // internal type type Cache<TFunc extends (this: any, ...args: any[]) => any> = { lastThis: ThisParameterType<TFunc>; lastArgs: Parameters<TFunc>; lastResult: ReturnType<TFunc>; }; function memoizeOne<TFunc extends (this: any, ...newArgs: any[]) => any>( resultFn: TFunc, isEqual: EqualityFn<TFunc> = areInputsEqual, ): MemoizedFn<TFunc> { let cache: Cache<TFunc> | null = null; // breaking cache when context (this) or arguments change function memoized( this: ThisParameterType<TFunc>, ...newArgs: Parameters<TFunc> ): ReturnType<TFunc> { if (cache && cache.lastThis === this && isEqual(newArgs, cache.lastArgs)) { return cache.lastResult; } // Throwing during an assignment aborts the assignment: https://codepen.io/alexreardon/pen/RYKoaz // Doing the lastResult assignment first so that if it throws // the cache will not be overwritten const lastResult = resultFn.apply(this, newArgs); cache = { lastResult, lastArgs: newArgs, lastThis: this, }; return lastResult; } // Adding the ability to clear the cache of a memoized function memoized.clear = function clear() { cache = null; }; return memoized; } export default memoizeOne;
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 4
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
.htaccess
127 B
lr--r--r--
2026-03-14 01:49:21
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
are-inputs-equal.ts
1.20 KB
lrw-r--r--
2026-02-28 00:28:02
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
memoize-one.js.flow
343 B
lrw-r--r--
2026-02-28 00:26:56
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
memoize-one.ts
1.58 KB
lrw-r--r--
2026-02-28 00:28:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).