init
This commit is contained in:
7
mc_test/node_modules/lazy-val/out/main.d.ts
generated
vendored
Executable file
7
mc_test/node_modules/lazy-val/out/main.d.ts
generated
vendored
Executable file
@ -0,0 +1,7 @@
|
||||
export declare class Lazy<T> {
|
||||
private _value;
|
||||
private creator;
|
||||
constructor(creator: () => Promise<T>);
|
||||
readonly hasValue: boolean;
|
||||
value: Promise<T>;
|
||||
}
|
||||
26
mc_test/node_modules/lazy-val/out/main.js
generated
vendored
Executable file
26
mc_test/node_modules/lazy-val/out/main.js
generated
vendored
Executable file
@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Lazy = void 0;
|
||||
class Lazy {
|
||||
constructor(creator) {
|
||||
this._value = null;
|
||||
this.creator = creator;
|
||||
}
|
||||
get hasValue() {
|
||||
return this.creator == null;
|
||||
}
|
||||
get value() {
|
||||
if (this.creator == null) {
|
||||
return this._value;
|
||||
}
|
||||
const result = this.creator();
|
||||
this.value = result;
|
||||
return result;
|
||||
}
|
||||
set value(value) {
|
||||
this._value = value;
|
||||
this.creator = null;
|
||||
}
|
||||
}
|
||||
exports.Lazy = Lazy;
|
||||
//# sourceMappingURL=main.js.map
|
||||
1
mc_test/node_modules/lazy-val/out/main.js.map
generated
vendored
Executable file
1
mc_test/node_modules/lazy-val/out/main.js.map
generated
vendored
Executable file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;;AAAA,MAAa,IAAI;IAIf,YAAY,OAAyB;QAH7B,WAAM,GAAsB,IAAI,CAAA;QAItC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,CAAA;IAC7B,CAAC;IAED,IAAI,KAAK;QACP,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,EAAE;YACxB,OAAO,IAAI,CAAC,MAAQ,CAAA;SACrB;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,CAAA;QAC7B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAA;QACnB,OAAO,MAAM,CAAA;IACf,CAAC;IAED,IAAI,KAAK,CAAC,KAAiB;QACzB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;QACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;IACrB,CAAC;CACF;AA1BD,oBA0BC","sourcesContent":["export class Lazy<T> {\n private _value: Promise<T> | null = null\n private creator: (() => Promise<T>) | null\n\n constructor(creator: () => Promise<T>) {\n this.creator = creator\n }\n\n get hasValue() {\n return this.creator == null\n }\n\n get value(): Promise<T> {\n if (this.creator == null) {\n return this._value!!\n }\n\n const result = this.creator()\n this.value = result\n return result\n }\n\n set value(value: Promise<T>) {\n this._value = value\n this.creator = null\n }\n}"]}
|
||||
Reference in New Issue
Block a user