Update lazyvalue
This commit is contained in:
@@ -1,16 +1,15 @@
|
|||||||
// This piece of code was orignally written by sindresorhus and can be seen here
|
// lazy-value by sindresorhus
|
||||||
// https://github.com/sindresorhus/lazy-value/blob/master/index.js
|
|
||||||
|
|
||||||
export default (fn) => {
|
module.exports = fn => {
|
||||||
let called = false
|
let called = false;
|
||||||
let ret
|
let result;
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (!called) {
|
if (!called) {
|
||||||
called = true
|
called = true;
|
||||||
ret = fn()
|
result = fn();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret
|
return result;
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user