mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-04-01 21:13:11 +00:00
chore: Do the migrations
This commit is contained in:
9
lib/util/once.ts
Normal file
9
lib/util/once.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
export function once<B>(fn: () => B): () => B {
|
||||
let result: [B] | [] = [];
|
||||
return () => {
|
||||
if (!result.length) {
|
||||
result = [fn()];
|
||||
}
|
||||
return result[0];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user