MCPcopy Index your code
hub / github.com/nodejs/node / getLazy

Function getLazy

lib/internal/util.js:772–782  ·  view source on GitHub ↗

* Helper function to lazy-load an initialize-once value. * @template T Return value of initializer * @param {()=>T} initializer Initializer of the lazily loaded value. * @returns {()=>T}

(initializer)

Source from the content-addressed store, hash-verified

770 * @returns {()=>T}
771 */
772function getLazy(initializer) {
773 let value;
774 let initialized = false;
775 return function() {
776 if (initialized === false) {
777 value = initializer();
778 initialized = true;
779 }
780 return value;
781 };
782}
783
784// Setup user-facing NODE_V8_COVERAGE environment variable that writes
785// ScriptCoverage objects to a specified directory.

Callers 11

util.jsFile · 0.85
path.jsFile · 0.85
_http_agent.jsFile · 0.85
fs.jsFile · 0.85
helpers.jsFile · 0.85
typescript.jsFile · 0.85
package_map.jsFile · 0.85
loader.jsFile · 0.85
promises.jsFile · 0.85
watchers.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…