From c2beadf4775e5229e8911fe96eac34fd07e7aa09 Mon Sep 17 00:00:00 2001 From: Fawad Mirzad Date: Sat, 13 Feb 2021 19:25:20 +0100 Subject: [PATCH] Update lazyvalue --- src/utils/lazyValue.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/utils/lazyValue.js b/src/utils/lazyValue.js index 7a1918c..6c25151 100644 --- a/src/utils/lazyValue.js +++ b/src/utils/lazyValue.js @@ -1,16 +1,15 @@ -// This piece of code was orignally written by sindresorhus and can be seen here -// https://github.com/sindresorhus/lazy-value/blob/master/index.js +// lazy-value by sindresorhus -export default (fn) => { - let called = false - let ret +module.exports = fn => { + let called = false; + let result; return () => { if (!called) { - called = true - ret = fn() + called = true; + result = fn(); } - return ret - } -} + return result; + }; +};