throw on unknown options
This commit is contained in:
@@ -46,9 +46,39 @@ File.helpers = [
|
||||
"get"
|
||||
];
|
||||
|
||||
File.validOptions = [
|
||||
"filename",
|
||||
"fileNameRelative",
|
||||
"blacklist",
|
||||
"whitelist",
|
||||
"optional",
|
||||
"modules",
|
||||
"sourceMap",
|
||||
"sourceMapName",
|
||||
"sourceFileName",
|
||||
"sourceRoot",
|
||||
"moduleRoot",
|
||||
"moduleIds",
|
||||
"runtime",
|
||||
"comments",
|
||||
"reactCompat",
|
||||
"keepModuleIdExtensions",
|
||||
"code",
|
||||
"ast",
|
||||
"format",
|
||||
"playground",
|
||||
"experimental"
|
||||
];
|
||||
|
||||
File.normaliseOptions = function (opts) {
|
||||
opts = _.cloneDeep(opts || {});
|
||||
|
||||
for (var key in opts) {
|
||||
if (File.validOptions.indexOf(key) < 0) {
|
||||
throw new ReferenceError("Unknown option: " + key);
|
||||
}
|
||||
}
|
||||
|
||||
_.defaults(opts, {
|
||||
keepModuleIdExtensions: false,
|
||||
experimental: false,
|
||||
|
||||
Reference in New Issue
Block a user