Browse Source

codePointAt is excessive

pull/1072/head
Tatsunori Uchino 5 months ago
parent
commit
1321d2eaa0
  1. 3
      lib/rules_inline/state_inline.mjs

3
lib/rules_inline/state_inline.mjs

@ -118,9 +118,8 @@ StateInline.prototype.scanDelims = function (start, canSplitWord) {
function getLastCharCode (str, pos) {
// treat beginning of the line as a whitespace
if (pos <= 0) { return 0x20 }
const charCode = str.codePointAt(pos - 1)
const charCode = str.charCodeAt(pos - 1)
// not low surrogates (BMP)
// undefined & 0xFC00 = 0, but never happens thanks to the first if
if ((charCode & 0xFC00) !== 0xDC00) { return charCode }
// undefined if out of range (leading stray low surrogates)

Loading…
Cancel
Save