UNPKG

fabric

Version:

Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.

3 lines (2 loc) 1.22 kB
import{getFabricWindow as r}from"../env/index.min.mjs";const t=function(r){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return`${r.charAt(0).toUpperCase()}${t?r.slice(1):r.slice(1).toLowerCase()}`},e=r=>r.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;");let o;const n=t=>{if(o||o||(o="Intl"in r()&&"Segmenter"in Intl&&new Intl.Segmenter(void 0,{granularity:"grapheme"})),o){const r=o.segment(t);return Array.from(r).map(r=>{let{segment:t}=r;return t})}return i(t)},i=r=>{const t=[];for(let e,o=0;o<r.length;o++)!1!==(e=g(r,o))&&t.push(e);return t},g=(r,t)=>{const e=r.charCodeAt(t);if(isNaN(e))return"";if(e<55296||e>57343)return r.charAt(t);if(55296<=e&&e<=56319){if(r.length<=t+1)throw"High surrogate without following low surrogate";const e=r.charCodeAt(t+1);if(56320>e||e>57343)throw"High surrogate without following low surrogate";return r.charAt(t)+r.charAt(t+1)}if(0===t)throw"Low surrogate without preceding high surrogate";const o=r.charCodeAt(t-1);if(55296>o||o>56319)throw"Low surrogate without preceding high surrogate";return!1};export{t as capitalize,e as escapeXml,n as graphemeSplit}; //# sourceMappingURL=lang_string.min.mjs.map