lazy
Callable
- const expensiveRead = lazy(() => fs.readDirSync('my/dir'));// fs.readDirSync not calledconsole.log(expensiveRead() // <- fs.readDirSync called, return value is put in cache);console.log(expensiveRead() // <- fs.readDirSync not called, return value from cache);
Returns the result of
getValue, that will be called once. Useful for expensive computation