-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (26 loc) · 773 Bytes
/
Copy pathindex.js
File metadata and controls
31 lines (26 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var parser = require('./parser.generated.js').parser;
exports.parse = function(argument) {
return parser.parse(argument);
};
var containsRepeatedSpace = /\s{2,}/;
exports.valid = function(argument) {
if (
argument.trim() !== argument ||
containsRepeatedSpace.test(argument)
) {
return false;
}
try {
parser.parse(argument);
return true;
} catch (e) {
// jison generates parsers that throw errors, while this function
// mimics `semver.valid` by returning null.
return null;
}
};
// Require the same license and exception data used by the parser.
exports.licenses = require('spdx-license-ids');
exports.exceptions = require('spdx-exceptions');
// The License Expression Syntax version
exports.specificationVersion = '2.0';