diff --git a/lib/6to5/types/index.js b/lib/6to5/types/index.js index b3e7434bb5..b796767370 100644 --- a/lib/6to5/types/index.js +++ b/lib/6to5/types/index.js @@ -64,6 +64,21 @@ _.each(t.FLIPPED_ALIAS_KEYS, function (types, type) { addAssert(type, is); }); +/** + * Description + * + * @param {Object} node + * @returns {Object} + */ + +t.toComputedPropertyKey = function (prop) { + var key = prop.key; + if (!prop.computed) { + if (t.isIdentifier(key)) key = t.literal(key.name); + } + return key; +}; + /* * Shallowly checks to see if the passed `node` will evaluate to a * falsy. This is if `node` is a `Literal` and `value` is falsy or