|
1 |
| -var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; |
2 |
| - |
3 |
| -function specifierIncluded(specifier) { |
4 |
| - var parts = specifier.split(' '); |
5 |
| - var op = parts.length > 1 ? parts[0] : '='; |
6 |
| - var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); |
7 |
| - |
8 |
| - for (var i = 0; i < 3; ++i) { |
9 |
| - var cur = parseInt(current[i] || 0, 10); |
10 |
| - var ver = parseInt(versionParts[i] || 0, 10); |
11 |
| - if (cur === ver) { |
12 |
| - continue; // eslint-disable-line no-restricted-syntax, no-continue |
13 |
| - } |
14 |
| - if (op === '<') { |
15 |
| - return cur < ver; |
16 |
| - } else if (op === '>=') { |
17 |
| - return cur >= ver; |
18 |
| - } |
19 |
| - return false; |
20 |
| - } |
21 |
| - return op === '>='; |
22 |
| -} |
23 |
| - |
24 |
| -function matchesRange(range) { |
25 |
| - var specifiers = range.split(/ ?&& ?/); |
26 |
| - if (specifiers.length === 0) { return false; } |
27 |
| - for (var i = 0; i < specifiers.length; ++i) { |
28 |
| - if (!specifierIncluded(specifiers[i])) { return false; } |
29 |
| - } |
30 |
| - return true; |
31 |
| -} |
32 |
| - |
33 |
| -function versionIncluded(specifierValue) { |
34 |
| - if (typeof specifierValue === 'boolean') { return specifierValue; } |
35 |
| - if (specifierValue && typeof specifierValue === 'object') { |
36 |
| - for (var i = 0; i < specifierValue.length; ++i) { |
37 |
| - if (matchesRange(specifierValue[i])) { return true; } |
38 |
| - } |
39 |
| - return false; |
40 |
| - } |
41 |
| - return matchesRange(specifierValue); |
42 |
| -} |
| 1 | +'use strict'; |
43 | 2 |
|
| 3 | +var isCoreModule = require('is-core-module'); |
44 | 4 | var data = require('./core.json');
|
45 | 5 |
|
46 | 6 | var core = {};
|
47 | 7 | for (var mod in data) { // eslint-disable-line no-restricted-syntax
|
48 | 8 | if (Object.prototype.hasOwnProperty.call(data, mod)) {
|
49 |
| - core[mod] = versionIncluded(data[mod]); |
| 9 | + core[mod] = isCoreModule(mod); |
50 | 10 | }
|
51 | 11 | }
|
52 | 12 | module.exports = core;
|
0 commit comments