Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
raviqqe committed Nov 10, 2023
1 parent efed9da commit e47292c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/once.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
export const once = <T extends (...args: any[]) => any>(f: T) => {
const called = false;
let called = false;
let value: ReturnType<T>;

return (...args: Parameters<T>): ReturnType<T> => {
if (!called) {
called = true;
value = f(...args);
}

Expand Down

0 comments on commit e47292c

Please sign in to comment.