import type { Fn } from "@thi.ng/api" ; import type { MapLike } from "./api.js" ; /**
 * Similar to  memoize1 , however optimized for side effects only, i.e.
 * functions which DO NOT return any result.
 *
 *  param fn param cache export const doOnce = < T > ( fn , cache ? ) => { ! cache && ( cache = new Map ( ) ) ; return ( x ) => { if ( ! cache ! . has ( x ) ) { cache ! . set ( x , true ) ; fn ( x ) ; } } ; } ;