Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3_1_X][TIMOB-26455] Sanitize numeric names #308

Merged
merged 1 commit into from Oct 17, 2018
Merged

[3_1_X][TIMOB-26455] Sanitize numeric names #308

merged 1 commit into from Oct 17, 2018

Conversation

garymathews
Copy link
Contributor

@@ -150,6 +150,10 @@ function safeName(name) {
if (name.match(/^(decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|escape|eval|isFinite|isNaN|parseFloat|parseInt|unescape|uneval)$/)) {
return '_' + name;
}
// Replace numeric prefix
if (name.match(/^\d+/)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (name.match(/^\d+/)) {
if (/^\d+/.test(name)) {

To just test the string for a match test is considerably faster. Shouldn't be much of an issue here but just for future reference (and i wanted to test the new suggest feature^^)

@janvennemann janvennemann merged commit 569d809 into tidev:3_1_X Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants