refactor start
This commit is contained in:
parent
bd49791e06
commit
e46d25f0b7
16699 changed files with 2 additions and 1484887 deletions
19
home/ags/node_modules/eslint-plugin-es-x/lib/util/optional-require.js
generated
vendored
19
home/ags/node_modules/eslint-plugin-es-x/lib/util/optional-require.js
generated
vendored
|
|
@ -1,19 +0,0 @@
|
|||
"use strict"
|
||||
|
||||
/**
|
||||
* Load a module optionally.
|
||||
* @param {Function} originalRequire The original `require` function.
|
||||
* @param {string} id The module specifier.
|
||||
*/
|
||||
function optionalRequire(originalRequire, id) {
|
||||
try {
|
||||
return originalRequire(id)
|
||||
} catch (error) {
|
||||
if (error && error.code === "MODULE_NOT_FOUND") {
|
||||
return undefined
|
||||
}
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { optionalRequire }
|
||||
Loading…
Add table
Add a link
Reference in a new issue