First pass at converting identifiers/words from en-au -> en-us
This commit is contained in:
@@ -25,7 +25,7 @@ function File(opts) {
|
||||
this.data = {};
|
||||
|
||||
this.lastStatements = [];
|
||||
this.opts = this.normaliseOptions(opts);
|
||||
this.opts = this.normalizeOptions(opts);
|
||||
this.ast = {};
|
||||
|
||||
this.buildTransformers();
|
||||
@@ -88,7 +88,7 @@ File.validOptions = [
|
||||
"accept"
|
||||
];
|
||||
|
||||
File.prototype.normaliseOptions = function (opts) {
|
||||
File.prototype.normalizeOptions = function (opts) {
|
||||
opts = clone(opts);
|
||||
|
||||
for (var key in opts) {
|
||||
@@ -118,7 +118,7 @@ File.prototype.normaliseOptions = function (opts) {
|
||||
ast: true
|
||||
});
|
||||
|
||||
// normalise windows path separators to unix
|
||||
// normalize windows path separators to unix
|
||||
opts.filename = opts.filename.replace(/\\/g, "/");
|
||||
|
||||
opts.basename = path.basename(opts.filename, path.extname(opts.filename));
|
||||
|
||||
@@ -24,7 +24,7 @@ function CodeGenerator(ast, opts, code) {
|
||||
|
||||
this.comments = ast.comments || [];
|
||||
this.tokens = ast.tokens || [];
|
||||
this.format = CodeGenerator.normaliseOptions(code, opts);
|
||||
this.format = CodeGenerator.normalizeOptions(code, opts);
|
||||
this.ast = ast;
|
||||
|
||||
this.whitespace = new Whitespace(this.tokens, this.comments);
|
||||
@@ -39,7 +39,7 @@ each(Buffer.prototype, function (fn, key) {
|
||||
};
|
||||
});
|
||||
|
||||
CodeGenerator.normaliseOptions = function (code, opts) {
|
||||
CodeGenerator.normalizeOptions = function (code, opts) {
|
||||
var style = " ";
|
||||
if (code) {
|
||||
var indent = detectIndent(code).indent;
|
||||
|
||||
@@ -131,7 +131,7 @@ var hookExtensions = function (_exts) {
|
||||
hookExtensions(util.canCompile.EXTENSIONS);
|
||||
|
||||
module.exports = function (opts) {
|
||||
// normalise options
|
||||
// normalize options
|
||||
opts = opts || {};
|
||||
|
||||
if (opts.only != null) onlyRegex = util.regexify(opts.only);
|
||||
|
||||
@@ -14,7 +14,7 @@ function transform(code, opts) {
|
||||
}
|
||||
|
||||
transform.fromAst = function (ast, code, opts) {
|
||||
ast = util.normaliseAst(ast);
|
||||
ast = util.normalizeAst(ast);
|
||||
|
||||
var file = new File(opts);
|
||||
file.addCode(code);
|
||||
|
||||
@@ -176,7 +176,7 @@ DefaultFormatter.prototype.getModuleName = function () {
|
||||
|
||||
moduleName += filenameRelative;
|
||||
|
||||
// normalise path separators
|
||||
// normalize path separators
|
||||
moduleName = moduleName.replace(/\\/g, "/");
|
||||
|
||||
return moduleName;
|
||||
@@ -230,7 +230,7 @@ DefaultFormatter.prototype.exportSpecifier = function (specifier, node, nodes) {
|
||||
nodes.push(this.buildExportsWildcard(ref, node));
|
||||
} else {
|
||||
if (t.isSpecifierDefault(specifier) && !this.noInteropRequire) {
|
||||
// importing a default so we need to normalise it
|
||||
// importing a default so we need to normalize it
|
||||
ref = t.callExpression(this.file.addHelper("interop-require"), [ref]);
|
||||
} else {
|
||||
ref = t.memberExpression(ref, t.getSpecifierId(specifier));
|
||||
|
||||
@@ -20,12 +20,12 @@ function Transformer(key, transformer, opts) {
|
||||
this.playground = !!transformer.playground;
|
||||
this.secondPass = !!transformer.secondPass;
|
||||
this.optional = !!transformer.optional;
|
||||
this.handlers = this.normalise(transformer);
|
||||
this.handlers = this.normalize(transformer);
|
||||
this.opts = opts || {};
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
Transformer.prototype.normalise = function (transformer) {
|
||||
Transformer.prototype.normalize = function (transformer) {
|
||||
var self = this;
|
||||
|
||||
if (isFunction(transformer)) {
|
||||
|
||||
@@ -29,7 +29,7 @@ var isVar = function (node, parent) {
|
||||
return t.isVariableDeclaration(node, { kind: "var" }) && !isLet(node, parent);
|
||||
};
|
||||
|
||||
var standardiseLets = function (declars) {
|
||||
var standardizeLets = function (declars) {
|
||||
for (var i = 0; i < declars.length; i++) {
|
||||
delete declars[i]._let;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ BlockScoping.prototype.getLetReferences = function () {
|
||||
if (!this.hasLetReferences) return;
|
||||
|
||||
// set let references to plain var references
|
||||
standardiseLets(declarators);
|
||||
standardizeLets(declarators);
|
||||
|
||||
var state = {
|
||||
letReferences: this.letReferences,
|
||||
|
||||
@@ -26,7 +26,7 @@ exports.ExportDeclaration = function (node, parent, scope, context, file) {
|
||||
var i;
|
||||
|
||||
if (node.declaration) {
|
||||
// make sure variable exports have an initialiser
|
||||
// make sure variable exports have an initializer
|
||||
// this is done here to avoid duplicating it in the module formatters
|
||||
if (t.isVariableDeclaration(node.declaration)) {
|
||||
var declar = node.declaration.declarations[0];
|
||||
|
||||
@@ -58,7 +58,7 @@ var spec = function (node, body, objId, initProps, file) {
|
||||
var props = node.properties;
|
||||
var prop, key;
|
||||
|
||||
// normalise key
|
||||
// normalize key
|
||||
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
prop = props[i];
|
||||
|
||||
@@ -123,7 +123,7 @@ exports.repeat = function (width, cha) {
|
||||
return result;
|
||||
};
|
||||
|
||||
exports.normaliseAst = function (ast, comments, tokens) {
|
||||
exports.normalizeAst = function (ast, comments, tokens) {
|
||||
if (ast && ast.type === "Program") {
|
||||
return t.file(ast, comments || [], tokens || []);
|
||||
} else {
|
||||
@@ -150,7 +150,7 @@ exports.parse = function (opts, code, callback) {
|
||||
|
||||
estraverse.attachComments(ast, comments, tokens);
|
||||
|
||||
ast = exports.normaliseAst(ast, comments, tokens);
|
||||
ast = exports.normalizeAst(ast, comments, tokens);
|
||||
|
||||
if (callback) {
|
||||
return callback(ast);
|
||||
|
||||
Reference in New Issue
Block a user