diff --git a/lib/6to5/file.js b/lib/6to5/file.js index 9420dfda58..b22bf8220e 100644 --- a/lib/6to5/file.js +++ b/lib/6to5/file.js @@ -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,