Skip to content

Commit bff6305

Browse files
committed
fix charAt usage over string
1 parent 8fc6a8b commit bff6305

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ function isIdnHostname(hostname) {
104104
// hyphen rules (the other one is covered by bidi)
105105
if (label.indexOf('--') === 2) throwIdnaSyntaxError('Label cannot contain consecutive hyphen-minus in the 3rd and 4th positions (RFC 5891 §4.2.3.1).');
106106
// leading combining marks check (some are not covered by bidi)
107-
if (/^\p{M}$/u.test(label.charAt(0))) throwIdnaSyntaxError(`Label cannot begin with combining/enclosing mark ${cpHex(label.codePointAt(0))} (RFC 5891 §4.2.3.2).`);
107+
if (/^\p{M}$/u.test(String.fromCodePoint(label.codePointAt(0)))) throwIdnaSyntaxError(`Label cannot begin with combining/enclosing mark ${cpHex(label.codePointAt(0))} (RFC 5891 §4.2.3.2).`);
108108
// spread cps for context and bidi checks
109109
const cps = Array.from(label).map((char) => char.codePointAt(0));
110110
let joinTypes = '';

0 commit comments

Comments
 (0)