We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 715830d commit aaaf1e1Copy full SHA for aaaf1e1
src/jsonformatter.ts
@@ -58,10 +58,12 @@ function jsString(s: string): string {
58
}
59
60
/**
61
- * Is this a valid "bare" property name?
+ * Is this a valid "bare" property name (e.g. a JS identifier name or a numeric
62
+ * literal)? See https://mathiasbynens.be/notes/javascript-properties, though we
63
+ * only support a subset of valid identifier names (no weird Unicode stuff).
64
*/
65
function isBareProp(prop: string): boolean {
- return /^[A-Za-z_$][A-Za-z0-9_\-$]*$/.test(prop);
66
+ return /^([0-9]+|[A-Za-z_$][A-Za-z0-9_$]*)$/.test(prop);
67
68
69
0 commit comments