|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
791 bytes
|
| Line | |
|---|
| 1 | export const fromCodePoint =
|
|---|
| 2 | String.fromCodePoint ||
|
|---|
| 3 | function (astralCodePoint: number) {
|
|---|
| 4 | return String.fromCharCode(
|
|---|
| 5 | Math.floor((astralCodePoint - 0x10000) / 0x400) + 0xd800,
|
|---|
| 6 | ((astralCodePoint - 0x10000) % 0x400) + 0xdc00
|
|---|
| 7 | );
|
|---|
| 8 | };
|
|---|
| 9 |
|
|---|
| 10 | // @ts-expect-error - String.prototype.codePointAt might not exist in older node versions
|
|---|
| 11 | export const getCodePoint = String.prototype.codePointAt
|
|---|
| 12 | ? function (input: string, position: number) {
|
|---|
| 13 | return input.codePointAt(position);
|
|---|
| 14 | }
|
|---|
| 15 | : function (input: string, position: number) {
|
|---|
| 16 | return (input.charCodeAt(position) - 0xd800) * 0x400 + input.charCodeAt(position + 1) - 0xdc00 + 0x10000;
|
|---|
| 17 | };
|
|---|
| 18 |
|
|---|
| 19 | export const highSurrogateFrom = 0xd800;
|
|---|
| 20 | export const highSurrogateTo = 0xdbff;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.