Skip to content

Commit

Permalink
fix: #1601 do not convert uppercase hexadecimal values into regular n…
Browse files Browse the repository at this point in the history
…umbers
  • Loading branch information
josdejong committed Jun 18, 2024
1 parent 3870ec1 commit 7ead8cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ export function parseString (str) {
}

const containsLeadingZero = /^0\d+$/
const startsWithZeroPrefix = /^0[xbo]/ // hex, binary, octal numbers
const startsWithZeroPrefix = /^0[xbo]/i // hex, binary, octal numbers
if (containsLeadingZero.test(str) || startsWithZeroPrefix.test(str)) {
// treat '001', '0x1A', '0b1101', and '0o3700' as a string
return str
Expand Down
3 changes: 3 additions & 0 deletions test/util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ describe('util', () => {
assert.strictEqual(parseString('0x1a'), '0x1a')
assert.strictEqual(parseString('0b1101'), '0b1101')
assert.strictEqual(parseString('0o3700'), '0o3700')
assert.strictEqual(parseString('0X1a'), '0X1a')
assert.strictEqual(parseString('0B1101'), '0B1101')
assert.strictEqual(parseString('0O3700'), '0O3700')
})

it('should find a unique name', () => {
Expand Down

0 comments on commit 7ead8cf

Please sign in to comment.