is-builtin-module
Advanced tools
Comparing version 3.0.0 to 3.1.0
10
index.js
@@ -5,2 +5,3 @@ 'use strict'; | ||
const moduleSet = new Set(builtinModules); | ||
const NODE_PROTOCOL = 'node:'; | ||
@@ -12,3 +13,12 @@ module.exports = moduleName => { | ||
if (moduleName.startsWith(NODE_PROTOCOL)) { | ||
moduleName = moduleName.slice(NODE_PROTOCOL.length); | ||
} | ||
const slashIndex = moduleName.indexOf('/'); | ||
if (slashIndex !== -1) { | ||
moduleName = moduleName.slice(0, slashIndex); | ||
} | ||
return moduleSet.has(moduleName); | ||
}; |
{ | ||
"name": "is-builtin-module", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"description": "Check if a string matches the name of a Node.js builtin module", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,2 +0,2 @@ | ||
# is-builtin-module [![Build Status](https://travis-ci.org/sindresorhus/is-builtin-module.svg?branch=master)](https://travis-ci.org/sindresorhus/is-builtin-module) | ||
# is-builtin-module | ||
@@ -21,2 +21,8 @@ > Check if a string matches the name of a Node.js builtin module | ||
isBuiltinModule('fs/promises'); | ||
//=> true | ||
isBuiltinModule('node:fs/promises'); | ||
//=> true | ||
isBuiltinModule('unicorn'); | ||
@@ -32,4 +38,12 @@ //=> false | ||
## License | ||
--- | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) | ||
<div align="center"> | ||
<b> | ||
<a href="https://tidelift.com/subscription/pkg/npm-is-builtin-module?utm_source=npm-is-builtin-module&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> | ||
</b> | ||
<br> | ||
<sub> | ||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. | ||
</sub> | ||
</div> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
3302
17
48
0