- Preparing search index...
- The search index is not available
moize
- default<MoizeableFn>(fn): Moized<MoizeableFn, Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<MoizeableFn>;
onCacheChange: OnCacheOperation<MoizeableFn>;
onCacheHit: OnCacheOperation<MoizeableFn>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}> & Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}>>
-
Type Parameters
-
MoizeableFn extends Moizeable
Returns Moized<MoizeableFn, Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<MoizeableFn>;
onCacheChange: OnCacheOperation<MoizeableFn>;
onCacheHit: OnCacheOperation<MoizeableFn>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}> & Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}>>
the memoized function
- default<MoizeableFn, PassedOptions>(fn, options): Moized<MoizeableFn, Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<MoizeableFn>;
onCacheChange: OnCacheOperation<MoizeableFn>;
onCacheHit: OnCacheOperation<MoizeableFn>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}> & Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}> & PassedOptions>
-
Type Parameters
-
MoizeableFn extends Moizeable
-
PassedOptions extends Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<MoizeableFn>;
onCacheChange: OnCacheOperation<MoizeableFn>;
onCacheHit: OnCacheOperation<MoizeableFn>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}>
Parameters
-
fn: MoizeableFn
-
options: PassedOptions
Returns Moized<MoizeableFn, Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<MoizeableFn>;
onCacheChange: OnCacheOperation<MoizeableFn>;
onCacheHit: OnCacheOperation<MoizeableFn>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}> & Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}> & PassedOptions>
the memoized function
- default<MoizedFn>(fn): Moized<MoizedFn["fn"], Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<MoizedFn>;
onCacheChange: OnCacheOperation<MoizedFn>;
onCacheHit: OnCacheOperation<MoizedFn>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}> & Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}>>
-
Type Parameters
-
MoizedFn extends AnyFn & Record<string, any> & Dictionary<any, MoizedFn> & {
cache: Cache<Moizeable>;
fn: Moizeable;
isMemoized: true;
options: NormalizedOptions<Moizeable>;
} & {
_microMemoizeOptions: Pick<Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}>, "isPromise" | "maxSize" | "onCacheAdd" | "onCacheChange" | "onCacheHit"> & {
isEqual: IsEqual;
isMatchingKey: IsMatchingKey;
transformKey: TransformKey;
};
cache: Cache<Moizeable>;
cacheSnapshot: Cache<Moizeable>;
clear: (() => void);
clearStats: (() => void);
contextTypes?: Record<string, Function>;
defaultProps?: Record<string, unknown>;
displayName?: string;
expirations: Expiration[];
expirationsSnapshot: Expiration[];
get: ((key) => any);
getStats: (() => StatsProfile);
has: ((key) => boolean);
isCollectingStats: (() => boolean);
isMoized: (() => true);
keys: (() => Key[]);
options: Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}>;
originalFunction: Moizeable;
propTypes: Record<string, Function>;
remove: ((key) => void);
set: ((key, value) => void);
values: (() => any[]);
}
Returns Moized<MoizedFn["fn"], Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<MoizedFn>;
onCacheChange: OnCacheOperation<MoizedFn>;
onCacheHit: OnCacheOperation<MoizedFn>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}> & Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}>>
the memoized function
- default<MoizedFn, PassedOptions>(fn, options): Moized<MoizedFn["fn"], Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<MoizedFn>;
onCacheChange: OnCacheOperation<MoizedFn>;
onCacheHit: OnCacheOperation<MoizedFn>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}> & Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}> & PassedOptions>
-
Type Parameters
-
MoizedFn extends AnyFn & Record<string, any> & Dictionary<any, MoizedFn> & {
cache: Cache<Moizeable>;
fn: Moizeable;
isMemoized: true;
options: NormalizedOptions<Moizeable>;
} & {
_microMemoizeOptions: Pick<Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}>, "isPromise" | "maxSize" | "onCacheAdd" | "onCacheChange" | "onCacheHit"> & {
isEqual: IsEqual;
isMatchingKey: IsMatchingKey;
transformKey: TransformKey;
};
cache: Cache<Moizeable>;
cacheSnapshot: Cache<Moizeable>;
clear: (() => void);
clearStats: (() => void);
contextTypes?: Record<string, Function>;
defaultProps?: Record<string, unknown>;
displayName?: string;
expirations: Expiration[];
expirationsSnapshot: Expiration[];
get: ((key) => any);
getStats: (() => StatsProfile);
has: ((key) => boolean);
isCollectingStats: (() => boolean);
isMoized: (() => true);
keys: (() => Key[]);
options: Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}>;
originalFunction: Moizeable;
propTypes: Record<string, Function>;
remove: ((key) => void);
set: ((key, value) => void);
values: (() => any[]);
}
-
PassedOptions extends Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<MoizedFn>;
onCacheChange: OnCacheOperation<MoizedFn>;
onCacheHit: OnCacheOperation<MoizedFn>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}>
Parameters
-
fn: MoizedFn
-
options: PassedOptions
Returns Moized<MoizedFn["fn"], Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<MoizedFn>;
onCacheChange: OnCacheOperation<MoizedFn>;
onCacheHit: OnCacheOperation<MoizedFn>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}> & Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}> & PassedOptions>
the memoized function
- default<PassedOptions>(options): Moizer<PassedOptions>
-
Type Parameters
-
PassedOptions extends Partial<{
isDeepEqual: boolean;
isPromise: boolean;
isReact: boolean;
isSerialized: boolean;
isShallowEqual: boolean;
matchesArg: IsEqual;
matchesKey: IsMatchingKey;
maxAge: number;
maxArgs: number;
maxSize: number;
onCacheAdd: OnCacheOperation<Moizeable>;
onCacheChange: OnCacheOperation<Moizeable>;
onCacheHit: OnCacheOperation<Moizeable>;
onExpire: OnExpire;
profileName: string;
serializer: Serialize;
transformArgs: TransformKey;
updateCacheForKey: UpdateCacheForKey;
updateExpire: boolean;
}>
Returns Moizer<PassedOptions>
the memoized function
Description
memoize a function based its arguments passed, potentially improving runtime performance
Example