mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 10:21:55 +00:00
chore: Do the migrations
This commit is contained in:
@@ -17,6 +17,7 @@ export { FileHelper } from "./fileHelper";
|
||||
export { getWrapperData } from "./getWrapperData";
|
||||
export { deepEqual } from "./deepEqual";
|
||||
export { deepMerge } from "./deepMerge";
|
||||
export { once } from "./once";
|
||||
|
||||
/** Used to check if the file exists before hand */
|
||||
export const exists = (
|
||||
|
||||
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