refactor start
This commit is contained in:
parent
bd49791e06
commit
e46d25f0b7
16699 changed files with 2 additions and 1484887 deletions
22
home/ags/node_modules/is-builtin-module/index.js
generated
vendored
22
home/ags/node_modules/is-builtin-module/index.js
generated
vendored
|
|
@ -1,22 +0,0 @@
|
|||
'use strict';
|
||||
const builtinModules = require('builtin-modules');
|
||||
|
||||
const moduleSet = new Set(builtinModules);
|
||||
const NODE_PROTOCOL = 'node:';
|
||||
|
||||
module.exports = moduleName => {
|
||||
if (typeof moduleName !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
if (moduleName.startsWith(NODE_PROTOCOL)) {
|
||||
moduleName = moduleName.slice(NODE_PROTOCOL.length);
|
||||
}
|
||||
|
||||
const slashIndex = moduleName.indexOf('/');
|
||||
if (slashIndex !== -1 && slashIndex !== moduleName.length - 1) {
|
||||
moduleName = moduleName.slice(0, slashIndex);
|
||||
}
|
||||
|
||||
return moduleSet.has(moduleName);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue