diff --git a/lib/6to5/types/index.js b/lib/6to5/types/index.js index a1e1135290..8d56f4aa2d 100644 --- a/lib/6to5/types/index.js +++ b/lib/6to5/types/index.js @@ -226,7 +226,7 @@ t.prependToMemberExpression = function (member, append) { }; /** - * Description + * Check if the input `node` is going to be evaluated, ie. is a refernece. * * @param {Object} node * @param {Object} parent @@ -331,13 +331,10 @@ t.toIdentifier = function (name) { name = name.replace(/^[-0-9]+/, ""); // camel case - name = name.replace(/[-_\s]+(.)?/g, function (match, c) { + name = name.replace(/[-\s]+(.)?/g, function (match, c) { return c ? c.toUpperCase() : ""; }); - // remove underscores from start of name - name = name.replace(/^\_/, ""); - if (!t.isValidIdentifier(name)) { name = "_" + name; }