Handle numeric identifiers

This commit is contained in:
Mingwei Samuel 2021-05-30 22:27:06 -07:00
parent ae0ff8745f
commit e7c9595a08

View file

@ -65,7 +65,9 @@ function normalizeArgName(name) {
}
function normalizePropName(propName) {
const out = changeCase.snakeCase(propName);
let out = changeCase.snakeCase(propName);
if (/^\d/.test(out)) // No leading digits.
out = 'x' + out;
if ('type' === out)
return 'r#' + out;
return out;