fabric
Version:
Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.
3 lines (2 loc) • 1.24 kB
JavaScript
import{getFabricWindow as t}from"../env/index.min.mjs";const r=function(t){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"".concat(t.charAt(0).toUpperCase()).concat(r?t.slice(1):t.slice(1).toLowerCase())},e=t=>t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">");let o;const n=r=>{if(o||o||(o="Intl"in t()&&"Segmenter"in Intl&&new Intl.Segmenter(void 0,{granularity:"grapheme"})),o){const t=o.segment(r);return Array.from(t).map((t=>{let{segment:r}=t;return r}))}return a(r)},a=t=>{const r=[];for(let e,o=0;o<t.length;o++)!1!==(e=i(t,o))&&r.push(e);return r},i=(t,r)=>{const e=t.charCodeAt(r);if(isNaN(e))return"";if(e<55296||e>57343)return t.charAt(r);if(55296<=e&&e<=56319){if(t.length<=r+1)throw"High surrogate without following low surrogate";const e=t.charCodeAt(r+1);if(56320>e||e>57343)throw"High surrogate without following low surrogate";return t.charAt(r)+t.charAt(r+1)}if(0===r)throw"Low surrogate without preceding high surrogate";const o=t.charCodeAt(r-1);if(55296>o||o>56319)throw"Low surrogate without preceding high surrogate";return!1};export{r as capitalize,e as escapeXml,n as graphemeSplit};
//# sourceMappingURL=lang_string.min.mjs.map