Skip to content

Commit 6cb91c5

Browse files
Replaced internal once function with "function-once"
1 parent 8f2cd60 commit 6cb91c5

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

package-lock.json

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"atomically": "^2.0.3",
3838
"fast-ignore": "^1.1.3",
3939
"find-up-json": "^2.0.4",
40+
"function-once": "^3.0.0",
4041
"import-meta-resolve": "^4.0.0",
4142
"is-binary-path": "^2.1.0",
4243
"js-yaml": "^4.1.0",

src/utils.ts

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import findUp from "find-up-json";
2+
import once from "function-once";
23
import { moduleResolve } from "import-meta-resolve";
34
import memoize from "lomemo";
45
import crypto from "node:crypto";
@@ -570,19 +571,6 @@ function omit<T extends object, K extends keyof T>(object: T, keys: K[]): Omit<T
570571
return clone;
571572
}
572573

573-
function once<T>(fn: () => T): () => T {
574-
let inited = false;
575-
let result: T;
576-
577-
return (): T => {
578-
if (!inited) {
579-
inited = true;
580-
result = fn();
581-
}
582-
return result;
583-
};
584-
}
585-
586574
function pluralize(value: string, length: number): string {
587575
return `${value}${length === 1 ? "" : "s"}`;
588576
}

0 commit comments

Comments
 (0)