MCPcopy Create free account
hub / github.com/nodejs/undici / detectRuntimeFeatureByNodeModule

Function detectRuntimeFeatureByNodeModule

lib/util/runtime-features.js:16–26  ·  view source on GitHub ↗

* @param {NodeModuleName} moduleName * @returns {boolean}

(moduleName)

Source from the content-addressed store, hash-verified

14 * @returns {boolean}
15 */
16function detectRuntimeFeatureByNodeModule (moduleName) {
17 try {
18 lazyLoaders[moduleName]()
19 return true
20 } catch (err) {
21 if (err.code !== 'ERR_UNKNOWN_BUILTIN_MODULE' && err.code !== 'ERR_NO_CRYPTO') {
22 throw err
23 }
24 return false
25 }
26}
27
28const runtimeFeaturesAsNodeModule = /** @type {const} */ (['crypto', 'sqlite'])
29/** @typedef {typeof runtimeFeaturesAsNodeModule[number]} RuntimeFeatureByNodeModule */

Callers 1

detectRuntimeFeatureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected