UNPKG

ll-package

Version:

2 lines (1 loc) 632 B
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var x=function(f){for(var r=[],s=f.length,e=0;e<s;e++){var u=f.charCodeAt(e);if(u>=55296&&u<=56319&&s>e+1){var h=f.charCodeAt(e+1);h>=56320&&h<=57343&&(u=(u-55296)*1024+h-56320+65536,e+=1)}if(u<128){r.push(u);continue}if(u<2048){r.push(u>>6|192),r.push(u&63|128);continue}if(u<55296||u>=57344&&u<65536){r.push(u>>12|224),r.push(u>>6&63|128),r.push(u&63|128);continue}if(u>=65536&&u<=1114111){r.push(u>>18|240),r.push(u>>12&63|128),r.push(u>>6&63|128),r.push(u&63|128);continue}r.push(239,191,189)}return new Uint8Array(r).buffer};exports.encodeUtf8=x;