Fix lazy.ts in payments lint
This commit is contained in:
parent
389ec8cb33
commit
db937f8110
3 changed files with 25 additions and 25 deletions
|
@ -4,16 +4,16 @@ function prop(object, name, f) {
|
|||
Object.defineProperty(object, name, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
let value = f.call(this);
|
||||
this[name] = value;
|
||||
return value;
|
||||
get() {
|
||||
const _value = f.call(this);
|
||||
this[name] = _value;
|
||||
return _value;
|
||||
},
|
||||
set: function (value) {
|
||||
set(_value) {
|
||||
Object.defineProperty(this, name, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: value,
|
||||
value: _value,
|
||||
writable: true,
|
||||
});
|
||||
},
|
||||
|
@ -21,12 +21,12 @@ function prop(object, name, f) {
|
|||
}
|
||||
exports.prop = prop;
|
||||
function value(f) {
|
||||
let value;
|
||||
return function () {
|
||||
if (value !== undefined)
|
||||
return value;
|
||||
value = f();
|
||||
return value;
|
||||
let _value;
|
||||
return () => {
|
||||
if (_value !== undefined)
|
||||
return _value;
|
||||
_value = f();
|
||||
return _value;
|
||||
};
|
||||
}
|
||||
exports.value = value;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
export function prop(object: Object, name: string, f: () => any): void {
|
||||
export function prop(object: {}, name: string, f: () => any): void {
|
||||
Object.defineProperty(object, name, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
let value = f.call(this);
|
||||
this[name] = value;
|
||||
return value;
|
||||
get() {
|
||||
const _value = f.call(this);
|
||||
this[name] = _value;
|
||||
return _value;
|
||||
},
|
||||
set: function(value) {
|
||||
set(_value) {
|
||||
Object.defineProperty(this, name, {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
value: value,
|
||||
value: _value,
|
||||
writable: true,
|
||||
});
|
||||
},
|
||||
|
@ -19,10 +19,10 @@ export function prop(object: Object, name: string, f: () => any): void {
|
|||
}
|
||||
|
||||
export function value<T>(f: () => T): () => T {
|
||||
let value: T;
|
||||
return function(): T {
|
||||
if (value !== undefined) return value;
|
||||
value = f();
|
||||
return value;
|
||||
let _value: T;
|
||||
return (): T => {
|
||||
if (_value !== undefined) return _value;
|
||||
_value = f();
|
||||
return _value;
|
||||
};
|
||||
}
|
||||
|
|
2
types/payments/lazy.d.ts
vendored
2
types/payments/lazy.d.ts
vendored
|
@ -1,2 +1,2 @@
|
|||
export declare function prop(object: Object, name: string, f: () => any): void;
|
||||
export declare function prop(object: {}, name: string, f: () => any): void;
|
||||
export declare function value<T>(f: () => T): () => T;
|
||||
|
|
Loading…
Reference in a new issue