import { deepEqual , sameValueZeroEqual , shallowEqual } from 'fast-equals' ; import { createGetInitialArgs } from './maxArgs' ; import { getIsSerializedKeyEqual , getSerializerFunction } from './serialize' ; import { Cache , IsEqual , IsMatchingKey , MicroMemoizeOptions , Moized , OnCacheOperation , Options , TransformKey , } from './types' ; import { compose } from './utils' ; export function createOnCacheOperation ( fn ? ) { if ( typeof fn === 'function' ) { return ( _cacheIgnored , _microMemoizeOptionsIgnored , memoized ) : void => fn ( memoized . cache , memoized . options , memoized ) ; } } private description param options returns export function getIsEqual ( options ) { return ( options . matchesArg || ( options . isDeepEqual && deepEqual ) || ( options . isShallowEqual && shallowEqual ) || sameValueZeroEqual ) ; } private description param options returns export function getIsMatchingKey ( options ) { return ( options . matchesKey || ( options . isSerialized && getIsSerializedKeyEqual ) || undefined ) ; } private description param options returns export function getTransformKey ( options ) { return compose ( options . isSerialized && getSerializerFunction ( options ) , typeof options . transformArgs === 'function' && options . transformArgs , typeof options . maxArgs === 'number' && createGetInitialArgs ( options . maxArgs ) ) as TransformKey ; }