Skip to content

Commit

Permalink
refactor(memoize): rename defonce() => defOnce()
Browse files Browse the repository at this point in the history
- deprecate old spelling
  • Loading branch information
postspectacular committed Apr 3, 2024
1 parent 745abbb commit 08e876f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/memoize/src/defonce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ const cache: Record<string, any> = Object.create(null);
* @param id -
* @param factory -
*/
export const defonce = <T>(id: string, factory: Fn0<T>): T =>
export const defOnce = <T>(id: string, factory: Fn0<T>): T =>
id in cache ? cache[id] : (cache[id] = factory());

/** @deprecated renamed to {@link defOnce} */
export const defonce = defOnce;

0 comments on commit 08e876f

Please sign in to comment.