UNPKG

@samchon/openapi

Version:

OpenAPI definitions and converters for 'typia' and 'nestia'.

14 lines (12 loc) 313 B
export namespace MapUtil { export const take = <Key, T>(dict: Map<Key, T>) => (key: Key) => (generator: () => T): T => { const oldbie: T | undefined = dict.get(key); if (oldbie) return oldbie; const value: T = generator(); dict.set(key, value); return value; }; }