Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
425 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var inspect = require('util').inspect;
|
---|
4 |
|
---|
5 | module.exports = function isResolvable(moduleId, options) {
|
---|
6 | if (typeof moduleId !== 'string') {
|
---|
7 | throw new TypeError(inspect(moduleId) + ' is not a string. Expected a valid Node.js module identifier (<string>), for example \'eslint\', \'./index.js\', \'./lib\'.');
|
---|
8 | }
|
---|
9 |
|
---|
10 | try {
|
---|
11 | require.resolve(moduleId, options);
|
---|
12 | return true;
|
---|
13 | } catch (err) {
|
---|
14 | return false;
|
---|
15 | }
|
---|
16 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.