From e7c9595a08f5d6fd4cb8327ea6f47ddb67f0ba12 Mon Sep 17 00:00:00 2001 From: Mingwei Samuel Date: Sun, 30 May 2021 22:27:06 -0700 Subject: [PATCH] Handle numeric identifiers --- srcgen/dotUtils.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/srcgen/dotUtils.js b/srcgen/dotUtils.js index 2fa621e..c05e9e8 100644 --- a/srcgen/dotUtils.js +++ b/srcgen/dotUtils.js @@ -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;