@visulima/string 3.0.0-alpha.15 → 3.0.0-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/align-text.js +2 -2
- package/dist/case/camel-case.js +1 -1
- package/dist/case/capital-case.js +1 -1
- package/dist/case/constant-case.js +1 -1
- package/dist/case/dot-case.js +1 -1
- package/dist/case/flat-case.js +1 -1
- package/dist/case/flip-case.js +1 -1
- package/dist/case/identify-case.js +1 -1
- package/dist/case/index.js +1 -1
- package/dist/case/kebab-case.js +1 -1
- package/dist/case/lower-first.js +1 -1
- package/dist/case/no-case.js +1 -1
- package/dist/case/pascal-case.js +1 -1
- package/dist/case/pascal-snake-case.js +1 -1
- package/dist/case/path-case.js +1 -1
- package/dist/case/sentence-case.js +1 -1
- package/dist/case/snake-case.js +1 -1
- package/dist/case/split-by-case.js +1 -1
- package/dist/case/title-case.js +1 -1
- package/dist/case/train-case.js +1 -1
- package/dist/case/upper-first.js +1 -1
- package/dist/closest-string.js +1 -1
- package/dist/compare-similarity.js +1 -1
- package/dist/get-string-truncated-width.js +1 -1
- package/dist/get-string-width.js +1 -1
- package/dist/index.js +1 -1
- package/dist/outdent.js +1 -1
- package/dist/packem_shared/LRUCache-Dm3jkQzc.js +1 -0
- package/dist/packem_shared/closest-C6YDQs4m.js +1 -0
- package/dist/packem_shared/closestN-DfsjM5M2.js +1 -0
- package/dist/packem_shared/constants-CImsldtV.js +1 -0
- package/dist/packem_shared/countOccurrences-DTjnj8Pm.js +1 -0
- package/dist/packem_shared/direction-Dp2CCCH6.js +1 -0
- package/dist/packem_shared/eastAsianWidthType-DDZo0voG.js +1 -0
- package/dist/packem_shared/excerpt-De-Waruz.js +34 -0
- package/dist/packem_shared/generate-cache-key-BqU1Cqwm.js +1 -0
- package/dist/packem_shared/indent-cz8WMI0e.js +1 -0
- package/dist/packem_shared/isFullwidthCodePoint-BMvc9BNh.js +1 -0
- package/dist/packem_shared/joinSegments-cvixBSMu.js +1 -0
- package/dist/packem_shared/lookup-DsIbtHWS.js +1 -0
- package/dist/packem_shared/normalize-german-eszett-hNMwtGjd.js +1 -0
- package/dist/packem_shared/redent-DqgI-fa_.js +1 -0
- package/dist/packem_shared/replaceString-DoWVBsen.js +1 -0
- package/dist/packem_shared/stripIndent-CPjAYUXh.js +1 -0
- package/dist/packem_shared/{transliterate-D1p1yYE7.js → transliterate-BYGS0N0m.js} +3 -3
- package/dist/slice.js +1 -1
- package/dist/slugify.js +1 -1
- package/dist/test/utils.js +2 -2
- package/dist/test/vitest.js +1 -1
- package/dist/truncate.js +1 -1
- package/dist/utilities.js +1 -1
- package/dist/word-similarity-sort.js +1 -1
- package/dist/word-wrap.js +7 -7
- package/package.json +1 -1
- package/dist/packem_shared/LRUCache-Dpk7Vnfr.js +0 -1
- package/dist/packem_shared/closest-uarbVSbs.js +0 -1
- package/dist/packem_shared/closestN-Daviv9V6.js +0 -1
- package/dist/packem_shared/constants-DmzZF6_u.js +0 -1
- package/dist/packem_shared/countOccurrences-DIHSCdcG.js +0 -1
- package/dist/packem_shared/direction-dtczwUOE.js +0 -1
- package/dist/packem_shared/eastAsianWidthType-GZeXsSGs.js +0 -1
- package/dist/packem_shared/excerpt-DhV2yoHG.js +0 -54
- package/dist/packem_shared/generate-cache-key-DPByFaMH.js +0 -1
- package/dist/packem_shared/indent-CDlPQmpe.js +0 -1
- package/dist/packem_shared/isFullwidthCodePoint-DJd4PBMe.js +0 -1
- package/dist/packem_shared/joinSegments-D27SxoCV.js +0 -1
- package/dist/packem_shared/lookup-CNDd-Nq4.js +0 -1
- package/dist/packem_shared/normalize-german-eszett-AKfdw2MZ.js +0 -1
- package/dist/packem_shared/redent-BECVOaZp.js +0 -1
- package/dist/packem_shared/replaceString-aq-C7Wor.js +0 -1
- package/dist/packem_shared/stripIndent-Dt8hSxVM.js +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## @visulima/string [3.0.0-alpha.16](https://github.com/visulima/visulima/compare/@visulima/string@3.0.0-alpha.15...@visulima/string@3.0.0-alpha.16) (2026-06-04)
|
|
2
|
+
|
|
3
|
+
### Performance Improvements
|
|
4
|
+
|
|
5
|
+
* **string:** disable esbuild keepNames in prod build ([8de9067](https://github.com/visulima/visulima/commit/8de906769625aa282246f470d4ff6dbb76cc52b2))
|
|
6
|
+
|
|
1
7
|
## @visulima/string [3.0.0-alpha.15](https://github.com/visulima/visulima/compare/@visulima/string@3.0.0-alpha.14...@visulima/string@3.0.0-alpha.15) (2026-06-04)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
package/dist/align-text.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
`,
|
|
1
|
+
import{getStringWidth as f}from"./get-string-width.js";const m=(t,r)=>Math.floor((t-r)/2),c=(t,r)=>t-r,u=(t,r={})=>{const s=r.align??"center";if(s==="left")return t;const a=r.split??`
|
|
2
|
+
`,g=r.pad??" ",h=s==="right"?c:m;let l=!1,i;Array.isArray(t)?i=t:(l=!0,i=t.split(a));let o,e=0;const p=i.map(n=>(o=f(n,r.stringWidthOptions),e=Math.max(o,e),{str:n,width:o})).map(n=>Array.from({length:h(e,n.width)+1}).join(g)+n.str);return l?p.join(a):p};export{u as alignText};
|
package/dist/case/camel-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{R as c}from"../packem_shared/constants-CImsldtV.js";import p from"../packem_shared/LRUCache-Dm3jkQzc.js";import f from"./lower-first.js";import{splitByCase as A}from"./split-by-case.js";import h from"./upper-first.js";import{n as d}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";import u from"../packem_shared/joinSegments-cvixBSMu.js";import{a as w}from"../packem_shared/normalize-german-eszett-hNMwtGjd.js";const y=new p(1e3),R=(t,o)=>{if(typeof t!="string"||!t)return"";const i=o?.cache??!1,n=o?.cacheStore??y;let r;if(i&&(r=d(t,o)),i&&r&&n.has(r))return n.get(r);let a=!0;const e=u(A(t,{handleAnsi:o?.handleAnsi,handleEmoji:o?.handleEmoji,knownAcronyms:o?.knownAcronyms,locale:o?.locale,normalize:o?.normalize,separators:void 0,stripAnsi:o?.stripAnsi,stripEmoji:o?.stripEmoji}).map(s=>{if(o?.handleAnsi&&c.test(s))return s;const m=o?.locale?.startsWith("de")?w(s):s,l=o?.locale?m.toLocaleLowerCase(o.locale):m.toLowerCase();return a?(a=!1,f(l,o)):h(l,o)}),"");return i&&r&&n.set(r,e),e};export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{R as m}from"../packem_shared/constants-CImsldtV.js";import c from"../packem_shared/LRUCache-Dm3jkQzc.js";import{splitByCase as p}from"./split-by-case.js";import f from"./upper-first.js";import{n as h}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";import A from"../packem_shared/joinSegments-cvixBSMu.js";import{a as d}from"../packem_shared/normalize-german-eszett-hNMwtGjd.js";const u=new c(1e3),S=(s,o)=>{if(typeof s!="string")return"";const i=o?.cache??!1,a=o?.cacheStore??u;let r;if(i&&(r=h(s,o)),i&&r&&a.has(r))return a.get(r);const l=p(s,{handleAnsi:o?.handleAnsi,handleEmoji:o?.handleEmoji,knownAcronyms:o?.knownAcronyms,locale:o?.locale,normalize:o?.normalize,separators:void 0,stripAnsi:o?.stripAnsi,stripEmoji:o?.stripEmoji}).map(t=>{if(m.test(t))return t;const e=o?.locale?.startsWith("de")?d(t):t;return f(o?.locale?e.toLocaleLowerCase(o.locale):e.toLocaleLowerCase(),o)}),n=A(l," ");return i&&r&&a.set(r,n),n};export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import r from"../packem_shared/LRUCache-Dm3jkQzc.js";import{kebabCase as t}from"./kebab-case.js";const a=new r(1e3),m=(e,o)=>t(e,{cacheStore:a,...o,joiner:"_",toUpperCase:!0});export{m as default};
|
package/dist/case/dot-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import r from"../packem_shared/LRUCache-Dm3jkQzc.js";import{kebabCase as a}from"./kebab-case.js";const t=new r(1e3),c=(e,o)=>a(e,{cacheStore:t,...o,joiner:"."});export{c as default};
|
package/dist/case/flat-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import r from"../packem_shared/LRUCache-Dm3jkQzc.js";import{kebabCase as t}from"./kebab-case.js";const a=new r(1e3),c=(e,o)=>t(e,{cacheStore:a,...o,joiner:""});export{c as default};
|
package/dist/case/flip-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{createRequire as m}from"node:module";import{s as _}from"../packem_shared/constants-CImsldtV.js";import j from"../packem_shared/LRUCache-Dm3jkQzc.js";import{n as C}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";const h=m(import.meta.url),l=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=s=>{if(typeof l<"u"&&l.versions&&l.versions.node){const[e,n]=l.versions.node.split(".").map(Number);if(e>22||e===22&&n>=3||e===20&&n>=16)return l.getBuiltinModule(s)}return h(s)},{stripVTControlCharacters:g}=d("node:util"),b=new j(1e3),v=(s,e)=>{if(typeof s!="string"||s.length===0)return"";const n=e?.cache??!1,a=e?.cacheStore??b;let r;if(n&&(r=C(s,e)),n&&r&&a.has(r))return a.get(r);let o=s;e?.stripEmoji&&(o=_(o)),e?.stripAnsi&&(o=g(o));let c="",t=0;for(;t<o.length;){if(e?.handleAnsi&&o[t]==="\x1B"){let f=o[t];for(t+=1;t<o.length&&o[t]!=="m";)f+=o[t],t+=1;t<o.length&&(f+=o[t],c+=f),t+=1;continue}const i=o[t],u=e?.locale?i.toLocaleLowerCase(e.locale):i.toLowerCase();let p;i===u?p=e?.locale?i.toLocaleUpperCase(e.locale):i.toUpperCase():p=u,c+=p,t+=1}return n&&r&&a.set(r,c),c};export{v as flipCase};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const n=/^([A-Z][a-z]*)+$/,r=/[a-z]/i,a=/^[A-Z0-9_]+$/,i=/^[a-z0-9_]+$/,u=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,l=/^[a-z ]+$/,o=/^[A-Z][A-Z0-9]*$/,p=/\s+/,z=/^\d+$/,c=/^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)+$/,f=/^[a-z]/,$=/[.!?;:,](?!\s|$)/,d=e=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(!e||!r.test(e))return"unknown";if(e.includes("_"))return a.test(e)?"upper_snake":i.test(e)?"snake":"mixed";if(e.includes("-"))return u.test(e)?"kebab":"mixed";if(l.test(e))return"lower";if(o.test(e))return"upper";const t=e.split(p);return t.length>1&&t.every(s=>n.test(s))||t.length>1&&z.test(t[0])&&n.test(t[1])?"title":t.length>1&&n.test(t[0])&&f.test(t[1])?"sentence":n.test(e)?"pascal":c.test(e)?"camel":$.test(e)?"unknown":"mixed"};export{d as default};
|
package/dist/case/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{default as t}from"./camel-case.js";import{default as r}from"./capital-case.js";import{default as f}from"./constant-case.js";import{default as l}from"./dot-case.js";import{default as x}from"./flat-case.js";import{flipCase as u}from"./flip-case.js";import{default as n}from"./identify-case.js";import{kebabCase as c}from"./kebab-case.js";import{default as b}from"./lower-first.js";import{default as F}from"./no-case.js";import{default as g}from"./pascal-case.js";import{default as j}from"./pascal-snake-case.js";import{default as B}from"./path-case.js";import{default as v}from"./sentence-case.js";import{default as A}from"./snake-case.js";import{splitByCase as E}from"./split-by-case.js";import{default as H}from"./title-case.js";import{default as J}from"./train-case.js";import{default as L}from"./upper-first.js";import{default as N}from"../packem_shared/joinSegments-
|
|
1
|
+
import{default as t}from"./camel-case.js";import{default as r}from"./capital-case.js";import{default as f}from"./constant-case.js";import{default as l}from"./dot-case.js";import{default as x}from"./flat-case.js";import{flipCase as u}from"./flip-case.js";import{default as n}from"./identify-case.js";import{kebabCase as c}from"./kebab-case.js";import{default as b}from"./lower-first.js";import{default as F}from"./no-case.js";import{default as g}from"./pascal-case.js";import{default as j}from"./pascal-snake-case.js";import{default as B}from"./path-case.js";import{default as v}from"./sentence-case.js";import{default as A}from"./snake-case.js";import{splitByCase as E}from"./split-by-case.js";import{default as H}from"./title-case.js";import{default as J}from"./train-case.js";import{default as L}from"./upper-first.js";import{default as N}from"../packem_shared/joinSegments-cvixBSMu.js";export{t as camelCase,r as capitalCase,f as constantCase,l as dotCase,x as flatCase,u as flipCase,n as identifyCase,N as joinSegments,c as kebabCase,b as lowerFirst,F as noCase,g as pascalCase,j as pascalSnakeCase,B as pathCase,v as sentenceCase,A as snakeCase,E as splitByCase,H as titleCase,J as trainCase,L as upperFirst};
|
package/dist/case/kebab-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{R as c}from"../packem_shared/constants-CImsldtV.js";import m from"../packem_shared/LRUCache-Dm3jkQzc.js";import{splitByCase as p}from"./split-by-case.js";import{n as f}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";import h from"../packem_shared/joinSegments-cvixBSMu.js";import{a as A}from"../packem_shared/normalize-german-eszett-hNMwtGjd.js";const d=new m(1e3),L=(s,o)=>{if(typeof s!="string")return"";const n=o?.cache??!1,e=o?.cacheStore??d;let r;if(n&&(r=f(s,o)),n&&r&&e.has(r))return e.get(r);const l=p(s,{handleAnsi:o?.handleAnsi,handleEmoji:o?.handleEmoji,knownAcronyms:o?.knownAcronyms,locale:o?.locale,normalize:o?.normalize,separators:void 0,stripAnsi:o?.stripAnsi,stripEmoji:o?.stripEmoji}).map(t=>{if(o?.handleAnsi&&c.test(t))return t;if(o?.toUpperCase)return o.locale?t.toLocaleUpperCase(o.locale):t.toUpperCase();const a=o?.locale?.startsWith("de")?A(t):t;return o?.locale?a.toLocaleLowerCase(o.locale):a.toLowerCase()}),i=h(l,o?.joiner??"-");return n&&r&&e.set(r,i),i};export{L as kebabCase};
|
package/dist/case/lower-first.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a=(e,o)=>typeof e!="string"||e===""?"":(o?.locale?e[0].toLocaleLowerCase(o.locale):e[0].toLowerCase())+e.slice(1);export{a as default};
|
package/dist/case/no-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import r from"../packem_shared/LRUCache-Dm3jkQzc.js";import{kebabCase as a}from"./kebab-case.js";const t=new r(1e3),c=(e,o)=>a(e,{cacheStore:t,...o,joiner:" "});export{c as default};
|
package/dist/case/pascal-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{R as e}from"../packem_shared/constants-CImsldtV.js";import m from"../packem_shared/LRUCache-Dm3jkQzc.js";import{splitByCase as c}from"./split-by-case.js";import p from"./upper-first.js";import{n as f}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";import h from"../packem_shared/joinSegments-cvixBSMu.js";import{a as A}from"../packem_shared/normalize-german-eszett-hNMwtGjd.js";const d=new m(1e3),L=(t,o)=>{if(typeof t!="string"||!t)return"";const n=o?.cache??!1,i=o?.cacheStore??d;let r;if(n&&(r=f(t,o)),n&&r&&i.has(r))return i.get(r);const a=h(c(t,{handleAnsi:o?.handleAnsi,handleEmoji:o?.handleEmoji,knownAcronyms:o?.knownAcronyms,locale:o?.locale,normalize:o?.normalize,separators:void 0,stripAnsi:o?.stripAnsi,stripEmoji:o?.stripEmoji}).map(s=>{if(o?.handleAnsi&&e.test(s))return s;const l=o?.locale?.startsWith("de")?A(s):s;return p(o?.locale?l.toLocaleLowerCase(o.locale):l.toLowerCase(),{locale:o?.locale})}),"");return n&&r&&i.set(r,a),a};export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import n from"../packem_shared/LRUCache-Dm3jkQzc.js";import l from"./no-case.js";import m from"./upper-first.js";import{n as p}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";const s=new n(1e3),d=(r,t)=>{if(typeof r!="string")return"";const o=t?.cache??!1,c=t?.cacheStore??s;let e;if(o&&(e=p(r,t)),o&&e&&c.has(e))return c.get(e);const f=l(r,{...t,cache:!1}).split(" ").map(i=>m(i,{locale:t?.locale})).join("_");return o&&e&&c.set(e,f),f};export{d as default};
|
package/dist/case/path-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import r from"../packem_shared/LRUCache-Dm3jkQzc.js";import{kebabCase as t}from"./kebab-case.js";const a=new r(1e3),c=(e,o)=>t(e,{cacheStore:a,...o,joiner:"/"});export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{R as c}from"../packem_shared/constants-CImsldtV.js";import p from"../packem_shared/LRUCache-Dm3jkQzc.js";import{splitByCase as f}from"./split-by-case.js";import h from"./upper-first.js";import{n as A}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";import d from"../packem_shared/joinSegments-cvixBSMu.js";import{a as u}from"../packem_shared/normalize-german-eszett-hNMwtGjd.js";const w=new p(1e3),k=(s,o)=>{if(typeof s!="string")return"";const i=o?.cache??!1,a=o?.cacheStore??w;let r;if(i&&(r=A(s,o)),i&&r&&a.has(r))return a.get(r);let n=!0;const e=d(f(s,{handleAnsi:o?.handleAnsi,handleEmoji:o?.handleEmoji,knownAcronyms:o?.knownAcronyms,locale:o?.locale,normalize:o?.normalize,separators:void 0,stripAnsi:o?.stripAnsi,stripEmoji:o?.stripEmoji}).map(t=>{if(o?.handleAnsi&&c.test(t))return t;const l=o?.locale?.startsWith("de")?u(t):t,m=o?.locale?l.toLocaleLowerCase(o.locale):l.toLowerCase();return n?(n=!1,h(m,o)):m})," ");return i&&r&&a.set(r,e),e};export{k as default};
|
package/dist/case/snake-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import r from"../packem_shared/LRUCache-Dm3jkQzc.js";import{kebabCase as t}from"./kebab-case.js";const a=new r(1e3),n=(e,o)=>t(e,{cacheStore:a,...o,joiner:"_"});export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{createRequire as Y}from"node:module";import{i as m,s as Z,l as Q,R as x,m as W,n as C,o as N,p as B,q as S,r as X,t as M,u as ee,v as G,w as K,x as H,y as te,z as se,A as ne,B as re,C as le,D as oe,E as ie,F as ae,G as ce,H as he,I as ue,J as pe,K as fe,L as ge,M as Ae,N as Ee}from"../packem_shared/constants-CImsldtV.js";import Re from"../packem_shared/LRUCache-Dm3jkQzc.js";const F=Y(import.meta.url),b=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,V=e=>{if(typeof b<"u"&&b.versions&&b.versions.node){const[r,h]=b.versions.node.split(".").map(Number);if(r>22||r===22&&h>=3||r===20&&h>=16)return b.getBuiltinModule(e)}return F(e)},{stripVTControlCharacters:$}=V("node:util"),T=new Re(1e3),_e=/[.*+?^${}()|[\]\\]/g,Le=e=>{const r=e.join("");if(T.has(r)){const A=T.get(r);return A.lastIndex=0,A}const h=e.map(A=>A.replaceAll(_e,String.raw`\$&`)).join("|"),g=new RegExp(h,"g");return T.set(r,g),g},Ce=e=>{const r=[];let h=0,g;for(m.lastIndex=0;(g=m.exec(e))!==null;)g.index>h&&r.push(e.slice(h,g.index)),r.push(g[0]),h=m.lastIndex;return h<e.length&&r.push(e.slice(h)),r.filter(Boolean)},de=/[ČŠŽĐ]/i,P=new Uint8Array(128),v=new Uint8Array(128),z=new Uint8Array(128);for(let e=0;e<128;e++)P[e]=e>=65&&e<=90?1:0,v[e]=e>=97&&e<=122?1:0,z[e]=e>=48&&e<=57?1:0;const j=e=>P[e],O=e=>v[e],w=e=>z[e],k=(e,r,h,g,A)=>{if(e.length===0)return[];let p=!1;const L=Object.values(r);for(const l of L)if(l(e[0])){p=!0;break}if(!p&&!h)return[e];const f=[...e],R=[];let s=f[0],o="other";const c=Object.entries(r);for(const l of c){const[n,a]=l;if(a(f[0])){o=n;break}}let t=h&&g?f[0]===f[0].toLocaleUpperCase(g):!1;for(let l=1;l<f.length;l++){const n=f[l];let a="other";for(const E of c){const[_,d]=E;if(d(n)){a=_;break}}const u=h&&g?n===n.toLocaleUpperCase(g):!1;let i=!1;A?i=A(o,a,t,u,n,l,f):(o!==a&&o!=="other"&&a!=="other"&&(i=!0),h&&a!=="other"&&!t&&u&&(i=!0)),i?(R.push(s),s=n):s+=n,o=a,h&&(t=u)}return s&&s.length>0&&R.push(s),R.length>0?R:[e]},Ue=(e,r,h,g)=>{if(h.size===0)return r;for(const A of h)if(e.startsWith(A,r))return g.push(A),r+A.length;return r},D=(e,r=new Set)=>{if(e.length===0)return[];if(e.toUpperCase()===e)return[e];let h=0;const g=[],A=e.length;for(let p=1;p<A;p++){const L=Ue(e,h,r,g);if(L!==h){h=L,p=h-1;continue}const f=e.codePointAt(p-1),R=e.codePointAt(p),s=f&&f<128&&j(f),o=R&&R<128&&j(R),c=f&&f<128&&O(f),t=f&&f<128&&w(f),l=R&&R<128&&w(R);if(c&&o){g.push(e.slice(h,p)),h=p;continue}if(t&&!l||!t&&l){g.push(e.slice(h,p)),h=p;continue}if(l&&!t){let n=!1,a=!1;if(p+1<A){const u=e.codePointAt(p+1);n=u&&u<128&&j(u),a=u&&u<128&&w(u)}if(!a&&n){g.push(e.slice(h,p),e.slice(p,p+1)),h=p+1;continue}}if(p+1<A){const n=e.codePointAt(p+1),a=n&&n<128&&O(n);if(s&&o&&a){const u=e.slice(h,p+1);r.has(u)||(g.push(e.slice(h,p)),h=p)}}}return h<A&&g.push(e.slice(h)),g.filter(p=>p!=="")},q=(e,r,h)=>{if(e.length===0)return[];const g=e===e.toLocaleUpperCase(r);if(r.startsWith("de")){if(!g&&e.replaceAll("ß","SS")===e.toLocaleUpperCase(r))return[e];const s=[...e],o=s.length,c=[];let t=s[0],l=s[0]===s[0].toLocaleUpperCase(r),n=l,a=l?0:-1;for(let u=1;u<o;u++){const i=s[u],E=i===i.toLocaleUpperCase(r);if(E===l)t+=i;else if(E)t&&t.length>0&&(c.push(t),t=i),n=!0,a=u;else{if(n&&u-a>1){const _=s[u-1],d=t.slice(0,-1);d&&d.length>0&&c.push(d),t=_+i}else t+=i;n=!1,a=-1}l=E}return t&&t.length>0&&c.push(t),c}if(r.startsWith("uk")||r.startsWith("ru")||r.startsWith("bg")||r.startsWith("sr")||r.startsWith("mk")||r.startsWith("be")){if(!W.test(e)&&!C.test(e))return[e];const s=[...e],o=s.length,c=[];let t=s[0];const l=s[0];let n;W.test(l)?n=1:C.test(l)?n=2:n=0;let a=l===l.toLocaleUpperCase(r);for(let i=1;i<o;i++){const E=s[i];let _;W.test(E)?_=1:C.test(E)?_=2:_=0;const d=E===E.toLocaleUpperCase(r);n!==_&&(n===1||n===2)&&(_===1||_===2)||_===n&&!a&&d?(c.push(t),t=E):t+=E,n=_,a=d}t&&t.length>0&&c.push(t);const u=[];for(let i=0;i<c.length;i++)i<c.length-1&&c[i].length===1&&C.test(c[i])&&W.test(c[i+1][0])?(u.push(c[i]+c[i+1]),i+=1):u.push(c[i]);return u}if(r.startsWith("el")){if(!N.test(e)&&!C.test(e))return[e];const s=[];B.lastIndex=0;let o;for(;(o=B.exec(e))!==null;)s.push(o[0]);s.length===0&&s.push(e);const c=[];if(s.length===1){const t=s[0];if(!t||!N.test(t[0])||t.length===1)return[t??e]}for(const t of s){if(!t)continue;if(!N.test(t[0])||t.length===1){c.push(t);continue}const l=t.length;let n=t[0],a=t[0]===t[0].toLocaleUpperCase(r);for(let u=1;u<l;u++){const i=t[u],E=i===i.toLocaleUpperCase(r);!a&&E?(c.push(n),n=i):n+=i,a=E}n&&c.push(n)}return c}if(r.startsWith("ja")||r.startsWith("ko")){const s=r.startsWith("ja"),o=s?{hiragana:t=>ee.test(t),kanji:t=>M.test(t),katakana:t=>X.test(t),latin:t=>C.test(t)}:{hangul:t=>G.test(t),latin:t=>C.test(t)},c=new Set(["が","で","と","に","の","は","へ","も","や","を"]);if(s){const t=k(e,o,!1,r,(n,a)=>n==="hiragana"&&a==="katakana"||n==="katakana"&&a==="hiragana"||n==="hiragana"&&a==="latin"||n==="katakana"&&a==="latin"||n==="kanji"&&a==="latin"||n==="latin"&&(a==="hiragana"||a==="katakana"||a==="kanji")),l=[];for(const n of t){const a=n;a.length===1&&c.has(a)&&l.length>0?l[l.length-1]=l.at(-1)+a:l.push(a)}return l.length>0?l:[e]}return k(e,o,!1,r,(t,l)=>t==="hangul"&&l==="latin"||t==="latin"&&l==="hangul")}if(r.startsWith("sl")){const s=[...e],o=s.length,c=[];let t=s[0],l=s[0]===s[0].toLocaleUpperCase(r);for(let n=1;n<o;n++){const a=s[n],u=a===a.toLocaleUpperCase(r),i=de.test(a),E=n<o-1&&s[n+1]===s[n+1].toLocaleUpperCase(r);!l&&u||i&&E?(c.push(t),t=a,i&&E&&(c.push(t),t="")):t+=a,l=u}return t&&t.length>0&&c.push(t),c}if(r.startsWith("zh"))return k(e,{han:s=>M.test(s),latin:s=>C.test(s)},!1,r);if(["ar","fa","he","ur"].includes(r.split("-")[0])){const s=o=>K.test(o)||H.test(o);return k(e,{latin:o=>C.test(o),rtl:o=>s(o)},!1,r)}if(["am","bn","gu","hi","km","kn","lo","ml","mr","ne","or","pa","si","ta","te","th"].includes(r.split("-")[0])){const s=o=>te.test(o)||se.test(o)||ne.test(o)||re.test(o)||le.test(o)||oe.test(o)||ie.test(o)||ae.test(o)||ce.test(o)||he.test(o)||ue.test(o)||pe.test(o)||fe.test(o)||ge.test(o)||Ae.test(o)||Ee.test(o);return k(e,{indic:o=>s(o),latin:o=>C.test(o)},!1,r)}if(["be","bg","ru","sr","uk"].includes(r))return k(e,{cyrillic:s=>W.test(s),latin:s=>C.test(s)},!0,r);if(["ar","fa","he"].includes(r))return k(e,{latin:s=>C.test(s),rtl:s=>K.test(s)||H.test(s)},!1,r);if(r.startsWith("ko"))return k(e,{hangul:s=>G.test(s),latin:s=>C.test(s)},!1,r);if(r.startsWith("uz")){if(!W.test(e)&&!C.test(e))return[e];const s=[...e],o=s.length,c=[];let t=s[0],l=s[0]===s[0].toLocaleUpperCase(r);for(let n=1;n<o;n++){const a=s[n],u=a===a.toLocaleUpperCase(r);if(S.test(a)||S.test(s[n-1])){t+=a;continue}!l&&u?(c.push(t),t=a):t+=a,l=u}return t&&t.length>0&&c.push(t),c}const A=[...e],p=A.length,L=[];let f=A[0],R=A[0]===A[0].toLocaleUpperCase(r);for(const s of h)if(e.startsWith(s)){L.push(s),f=A[s.length],R=f===f.toLocaleUpperCase(r);break}for(let s=1;s<p;s++){const o=A[s],c=o===o.toLocaleUpperCase(r);let t=0;for(const l of h)if(e.startsWith(l,s)){L.push(f,l),t=l.length,f="";const n=l.at(-1);n&&(R=n===n.toLocaleUpperCase(r));break}if(t>0){s+=t-1;continue}!R&&c?(L.push(f),f=o):f+=o,R=c}return f&&L.push(f),L},Ie=(e,r,h)=>{const g=[],A=x.test(e)?e.split(x).filter(Boolean):[e];for(const p of A){const L=p;if(x.test(L))g.push(L);else{m.lastIndex=0;const f=m.test(L)?Ce(L).filter(Boolean):[L];for(const R of f)if(m.lastIndex=0,m.test(R))g.push(R);else if(r){const s=r.toLowerCase().split("-")[0];g.push(...q(R,s,h))}else g.push(...D(R,h))}}return g},be=(e,r={})=>{if(!e||typeof e!="string")return[];const{handleAnsi:h=!1,handleEmoji:g=!1,knownAcronyms:A=[],locale:p,normalize:L=!1,separators:f,stripAnsi:R=!1,stripEmoji:s=!1}=r,o=new Set([...A].toSorted((i,E)=>E.length-i.length));let c=e;R&&(c=$(c)),s&&(c=Z(c));let t;Array.isArray(f)?t=Le(f):f instanceof RegExp?t=f:t=Q;const l=[];let n=c;const a=t.flags.includes("g")?t:new RegExp(t.source,`${t.flags}g`);for(;n.length>0;){const i=a.exec(n);if(!i){n===".."?l.push(".."):n==="."?l.push("."):n.length>0&&l.push(n);break}const E=i.index,_=i[0],d=_.length,y=n.slice(0,E),J=n.slice(E+d);if(_.startsWith("../"))l.push(".."),n=n.slice(E+3);else if(_.startsWith("./"))l.push("."),n=n.slice(E+2);else if(E===0&&_==="..")l.push(".."),n=n.slice(2);else if(E===0&&_===".")l.push("."),n=n.slice(1);else{y.length>0&&l.push(y);let U=0;for(;(U=_.indexOf("../",U))!==-1;)l.push(".."),U+=3;for(U=0;(U=_.indexOf("./",U))!==-1;)(U===0||_[U-1]!==".")&&l.push("."),U+=2;let I=J;for(;I.startsWith("../");)l.push(".."),I=I.slice(3);for(;I.startsWith("./");)l.push("."),I=I.slice(2);if(I===".."){l.push("..");break}else if(I==="."){l.push(".");break}else n=I}a.lastIndex=0}if(l.length===0){const i=c.split(t).filter(Boolean);l.push(...i)}let u=[];for(const i of l)h||g?u.push(...Ie(i,p,o)):p?u.push(...q(i,p,o)):u.push(...D(i,o));return L&&(u=u.map(i=>o.has(i)?i:p&&i===i.toLocaleUpperCase(p)?i[0]+i.slice(1).toLocaleLowerCase(p):i.toUpperCase()===i&&!o.has(i)?i.slice(0,1)+i.slice(1).toLowerCase():i)),u};export{be as splitByCase};
|
package/dist/case/title-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import e from"../packem_shared/LRUCache-Dm3jkQzc.js";import{splitByCase as c}from"./split-by-case.js";import m from"./upper-first.js";import{n as p}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";import{a as f}from"../packem_shared/normalize-german-eszett-hNMwtGjd.js";const d=new e(1e3);function y(t,o){if(typeof t!="string")return"";const a=o?.cache??!1,i=o?.cacheStore??d;let r;if(a&&(r=p(t,o)),a&&r&&i.has(r))return i.get(r);const n=c(t,{handleAnsi:o?.handleAnsi,handleEmoji:o?.handleEmoji,knownAcronyms:o?.knownAcronyms,locale:o?.locale,normalize:o?.normalize,separators:void 0,stripAnsi:o?.stripAnsi,stripEmoji:o?.stripEmoji}).map(s=>{const l=o?.locale?.startsWith("de")?f(s):s;return m(o?.locale?l.toLocaleLowerCase(o.locale):l.toLowerCase(),{locale:o?.locale})}).join(" ");return a&&r&&i.set(r,n),n}export{y as default};
|
package/dist/case/train-case.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import a from"../packem_shared/LRUCache-Dm3jkQzc.js";import{splitByCase as l}from"./split-by-case.js";import e from"./upper-first.js";import{n as p}from"../packem_shared/generate-cache-key-BqU1Cqwm.js";import c from"../packem_shared/joinSegments-cvixBSMu.js";const f=new a(1e3),y=(n,o)=>{if(typeof n!="string")return"";const t=o?.cache??!1,i=o?.cacheStore??f;let r;if(t&&(r=p(n,o)),t&&r&&i.has(r))return i.get(r);const s=c(l(n,{handleAnsi:o?.handleAnsi,handleEmoji:o?.handleEmoji,knownAcronyms:o?.knownAcronyms,locale:o?.locale,normalize:o?.normalize,separators:void 0,stripAnsi:o?.stripAnsi,stripEmoji:o?.stripEmoji}).map(m=>e(m,{locale:o?.locale})),"-");return t&&r&&i.set(r,s),s};export{y as default};
|
package/dist/case/upper-first.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const a=(e,o)=>typeof e!="string"||e===""?"":(o?.locale?e[0].toLocaleUpperCase(o.locale):e[0].toUpperCase())+e.slice(1);export{a as default};
|
package/dist/closest-string.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{distance as p}from"./packem_shared/closest-C6YDQs4m.js";const d=(s,o,l)=>{if(o.length===0)throw new TypeError("When using closestString(), the possibleWords array must contain at least one word");const{caseSensitive:e,compareFn:r=p}={...l},n=e?s:s.toLowerCase();let a=o[0]??void 0,i=1/0;for(const g of o){const t=g,c=e?r(n,t):r(n,t.toLowerCase());c<i&&(a=t,i=c)}return a};export{d as closestString};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{distance as i}from"./packem_shared/closest-C6YDQs4m.js";const n=(o,s)=>{const{compareFn:e=i}={...s};if(s?.caseSensitive)return(t,r)=>e(o,t)-e(o,r);const a=o.toLowerCase();return(t,r)=>e(a,t.toLowerCase())-e(a,r.toLowerCase())};export{n as compareSimilarity};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{eastAsianWidthType as T}from"./packem_shared/eastAsianWidthType-DDZo0voG.js";import{g as m,h as b,i as k}from"./packem_shared/constants-CImsldtV.js";const A=new Map,W=/(?:[\u0020-\u007E\u00A0-\u00FF](?!\uFE0F)){1,1000}/y,I=i=>i>=32&&i<=126?"latin":i===8203||i===8204||i===8205||i===8288?"zero":i<=31||i>=127&&i<=159?"control":i>=160&&i<=255||i>=9472&&i<=9599?"latin":i>=4352&&i<=4607||i>=11904&&i<=40959||i>=44032&&i<=55215||i>=63744&&i<=64255||i>=65280&&i<=65519&&!(i>=65377&&i<=65439)||i>=12352&&i<=12543?"wide":i===8230?"latin":"other",_=(i,l)=>{const e=Math.floor(i/65536),s=i%65536;let h=A.get(e);if(h||(h=new Map,A.set(e,h)),h.has(s))return h.get(s);let u;if(I(i)==="latin")u=l.width.regular;else if(I(i)==="control")u=l.width.control;else if(I(i)==="wide")u=l.width.wide;else switch(T(i)){case"ambiguous":{u=l.width.ambiguousIsNarrow?l.width.regular:l.width.wide;break}case"fullwidth":{u=l.width.fullWidth;break}case"wide":{u=l.width.wide;break}default:u=l.width.regular}return h.set(s,u),u},B=i=>i>=768&&i<=879||i>=6832&&i<=6911||i>=7616&&i<=7679||i>=8400&&i<=8447||i>=65056&&i<=65071||i>=917760&&i<=917999||i>=65024&&i<=65039||i>=3633&&i<=3642||i>=3655&&i<=3662||i>=3761&&i<=3769||i>=3771&&i<=3772||i>=3784&&i<=3789||i>=2304&&i<=2307||i>=2362&&i<=2383||i>=2385&&i<=2391||i>=2402&&i<=2403||i>=2433&&i<=2435||i>=2492&&i<=2500||i>=2509&&i<=2509||i>=2561&&i<=2563||i>=2620&&i<=2637||i>=1611&&i<=1631||i>=1648&&i<=1648||i>=1750&&i<=1773||i>=2276&&i<=2302||i>=1425&&i<=1469||i>=1471&&i<=1471||i>=1473&&i<=1474||i>=1476&&i<=1477||i>=1479&&i<=1479||i>=3893&&i<=3893||i>=3895&&i<=3895||i>=3897&&i<=3897||i>=3953&&i<=3966||i>=3968&&i<=3972||i>=3974&&i<=3975?!0:i>=768&&i<=777||i>=803&&i<=803,O=(i,l={})=>{if(!i||i.length===0)return{ellipsed:!1,index:0,truncated:!1,width:0};const e={truncation:{countAnsiEscapeCodes:l.countAnsiEscapeCodes??!1,ellipsis:l.ellipsis??"",ellipsisWidth:l.ellipsisWidth??(l.ellipsis?O(l.ellipsis,{...l,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width:0),limit:l.limit??Number.POSITIVE_INFINITY},width:{ambiguousIsNarrow:l.ambiguousIsNarrow??!1,ansi:l.ansiWidth??0,control:l.controlWidth??0,emoji:l.emojiWidth??2,fullWidth:l.fullWidth??2,halfWidth:l.halfWidth??1,regular:l.regularWidth??1,tab:l.tabWidth??8,wide:l.wideWidth??2}},s=Math.max(0,e.truncation.limit-e.truncation.ellipsisWidth),{length:h}=i,u=h>1e4;let a=0,n=0,t=h,d=!1;const j=i.includes("\x1B")||i.includes("");for(;a<h;){if(j&&(i[a]==="\x1B"||i[a]==="")){if(i.startsWith("\x1B]8;;",a)){const o="\x1B]8;;\x07",w=o.length,g=i.indexOf("\x07",a+5);if(g!==-1){const p=i.indexOf(o,g+1);if(p!==-1){const C=p+w,F=i.slice(g+1,p).replace(m,""),E=O(F,{ambiguousIsNarrow:e.width.ambiguousIsNarrow,ansiWidth:e.width.ansi,controlWidth:e.width.control,countAnsiEscapeCodes:!1,ellipsis:e.truncation.ellipsis,ellipsisWidth:e.truncation.ellipsisWidth,emojiWidth:e.width.emoji,fullWidth:e.width.fullWidth,halfWidth:e.width.halfWidth,limit:Math.max(0,s-n),regularWidth:e.width.regular,tabWidth:e.width.tab,wideWidth:e.width.wide}),x=E.width;if(E.truncated)d=!0,t=Math.min(t,a);else if(n+x>s&&(t=Math.min(t,a),d=!0,n+x>e.truncation.limit))break;if(n+=x,a=C,d&&n>=e.truncation.limit)break;continue}}}if(m.lastIndex=a,m.test(i)){const o=m.lastIndex-a,w=e.truncation.countAnsiEscapeCodes?o:e.width.ansi;if(n+w>s&&(t=Math.min(t,a),n+w>e.truncation.limit)){d=!0;break}n+=w,a=m.lastIndex;continue}}const c=i.codePointAt(a);if(c===8203||c===65279||c>=8288&&c<=8292){a+=1;continue}if(c===9){if(n+e.width.tab>s&&(t=Math.min(t,a),n+e.width.tab>e.truncation.limit)){d=!0;break}n+=e.width.tab,a+=1;continue}if(W.lastIndex=a,W.test(i)){const o=(W.lastIndex-a)*e.width.regular;if(n+o>s){const w=Math.floor((s-n)/e.width.regular);if(t=Math.min(t,a+w),n+o>e.truncation.limit){d=!0;break}}n+=o,a=W.lastIndex;continue}if((c<=31||c>=127&&c<=159)&&(b.lastIndex=a,b.test(i))){const o=(b.lastIndex-a)*e.width.control;if(n+o>s&&(t=Math.min(t,a+Math.floor((s-n)/e.width.control)),n+o>e.truncation.limit)){d=!0;break}n+=o,a=b.lastIndex;continue}if(k.lastIndex=a,k.test(i)){if(n+e.width.emoji>s&&(t=Math.min(t,a),n+e.width.emoji>e.truncation.limit)){d=!0;break}n+=e.width.emoji,a=k.lastIndex;continue}const f=i.codePointAt(a)??0;if(B(f)){a+=f>65535?2:1;continue}let r;if(u)r=_(f,e);else switch(I(f)){case"control":{r=e.width.control;break}case"latin":{r=e.width.regular;break}case"wide":{r=e.width.wide;break}case"zero":{r=0;break}default:switch(T(f)){case"ambiguous":{r=e.width.ambiguousIsNarrow?e.width.regular:e.width.wide;break}case"fullwidth":{r=e.width.fullWidth;break}case"wide":{r=e.width.wide;break}default:r=e.width.regular}}if(n+r>s&&(t=Math.min(t,a),n+r>e.truncation.limit)){d=!0;break}n+=r,a+=f>65535?2:1}let M=n,N=!1;return d&&e.truncation.limit>=e.truncation.ellipsisWidth&&(M=e.truncation.limit,N=!0),{ellipsed:N,index:d?t:h,truncated:d,width:M}};export{O as getStringTruncatedWidth};
|
package/dist/get-string-width.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{getStringTruncatedWidth as e}from"./get-string-truncated-width.js";const d=(i,t={})=>e(i,{...t,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width;export{d as getStringWidth};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{alignText as r}from"./align-text.js";import{default as a}from"./case/camel-case.js";import{default as s}from"./case/capital-case.js";import{default as m}from"./case/constant-case.js";import{default as d}from"./case/dot-case.js";import{default as i}from"./case/flat-case.js";import{flipCase as u}from"./case/flip-case.js";import{default as C}from"./case/identify-case.js";import{kebabCase as S}from"./case/kebab-case.js";import{default as y}from"./case/lower-first.js";import{default as w}from"./case/no-case.js";import{default as F}from"./case/pascal-case.js";import{default as T}from"./case/pascal-snake-case.js";import{default as A}from"./case/path-case.js";import{default as R}from"./case/sentence-case.js";import{default as B}from"./case/snake-case.js";import{splitByCase as I}from"./case/split-by-case.js";import{default as N}from"./case/title-case.js";import{default as v}from"./case/train-case.js";import{default as D}from"./case/upper-first.js";import{default as H}from"./packem_shared/joinSegments-
|
|
1
|
+
import{alignText as r}from"./align-text.js";import{default as a}from"./case/camel-case.js";import{default as s}from"./case/capital-case.js";import{default as m}from"./case/constant-case.js";import{default as d}from"./case/dot-case.js";import{default as i}from"./case/flat-case.js";import{flipCase as u}from"./case/flip-case.js";import{default as C}from"./case/identify-case.js";import{kebabCase as S}from"./case/kebab-case.js";import{default as y}from"./case/lower-first.js";import{default as w}from"./case/no-case.js";import{default as F}from"./case/pascal-case.js";import{default as T}from"./case/pascal-snake-case.js";import{default as A}from"./case/path-case.js";import{default as R}from"./case/sentence-case.js";import{default as B}from"./case/snake-case.js";import{splitByCase as I}from"./case/split-by-case.js";import{default as N}from"./case/title-case.js";import{default as v}from"./case/train-case.js";import{default as D}from"./case/upper-first.js";import{default as H}from"./packem_shared/joinSegments-cvixBSMu.js";import{closestString as K}from"./closest-string.js";import{compareSimilarity as Q}from"./compare-similarity.js";import{countOccurrences as V}from"./packem_shared/countOccurrences-DTjnj8Pm.js";import{direction as Y}from"./packem_shared/direction-Dp2CCCH6.js";import{excerpt as _}from"./packem_shared/excerpt-De-Waruz.js";import{getStringTruncatedWidth as ee}from"./get-string-truncated-width.js";import{getStringWidth as re}from"./get-string-width.js";import{default as ae}from"./packem_shared/isFullwidthCodePoint-BMvc9BNh.js";import{closestN as se}from"./packem_shared/closestN-DfsjM5M2.js";import{outdent as me}from"./outdent.js";import{default as de}from"./packem_shared/replaceString-DoWVBsen.js";import{slice as ie}from"./slice.js";import{default as ue}from"./slugify.js";import{default as Ce}from"./packem_shared/transliterate-BYGS0N0m.js";import{truncate as Se}from"./truncate.js";import{escapeRegExp as ye,findStringOccurrences as We,hasChinese as we,hasPunctuationOrSpace as ke,inRange as Fe}from"./utilities.js";import{wordSimilaritySort as Te}from"./word-similarity-sort.js";import{WrapMode as Ae,wordWrap as Pe}from"./word-wrap.js";import{default as je}from"./packem_shared/indent-cz8WMI0e.js";import{default as Ee}from"./packem_shared/redent-DqgI-fa_.js";import{dedent as Me,default as Ne}from"./packem_shared/stripIndent-CPjAYUXh.js";import{closest as ve,distance as ze}from"./packem_shared/closest-C6YDQs4m.js";import{eastAsianWidth as Ge,eastAsianWidthType as He}from"./packem_shared/eastAsianWidthType-DDZo0voG.js";export{Ae as WrapMode,r as alignText,a as camelCase,s as capitalCase,ve as closest,se as closestN,K as closestString,Q as compareSimilarity,m as constantCase,V as countOccurrences,Me as dedent,Y as direction,ze as distance,d as dotCase,Ge as eastAsianWidth,He as eastAsianWidthType,ye as escapeRegExp,_ as excerpt,We as findStringOccurrences,i as flatCase,u as flipCase,ee as getStringTruncatedWidth,re as getStringWidth,we as hasChinese,ke as hasPunctuationOrSpace,C as identifyCase,Fe as inRange,je as indent,ae as isFullwidthCodePoint,H as joinSegments,S as kebabCase,y as lowerFirst,w as noCase,me as outdent,F as pascalCase,T as pascalSnakeCase,A as pathCase,Ee as redent,de as replaceString,R as sentenceCase,ie as slice,ue as slugify,B as snakeCase,I as splitByCase,Ne as stripIndent,N as titleCase,v as trainCase,Ce as transliterate,Se as truncate,D as upperFirst,Te as wordSimilaritySort,Pe as wordWrap};
|
package/dist/outdent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{a as A,b as R,c as p,d as S,e as W,f as d}from"./packem_shared/constants-CImsldtV.js";const I=(e,r)=>Object.hasOwn(e,r),T=(e,r)=>Object.assign(e,r),u=(e,r,n)=>{if(e.length===0)return[];let t=0;const s=d.exec(e[0]);s&&(t=s[1].length);const i=String.raw`(\r\n|\r|\n).{0,${t}}`,o=new RegExp(i,"g"),l=r?e.slice(1):e,{newline:N,trimLeadingNewline:_,trimTrailingNewline:E}=n,f=typeof N=="string",g=l.length,h=Array.from({length:g});for(let c=0;c<g;c++){let a=l[c];a=a.replace(o,"$1"),c===0&&_&&(a=a.replace(A,"")),c===g-1&&E&&(a=a.replace(R,"")),f&&(a=a.replaceAll(W,N)),h[c]=a}return h},m=(e,r)=>{const n=Array.from({length:e.length+r.length});let t=0;const s=e.length;for(;t<s-1;t++)n[t*2]=e[t],n[t*2+1]=String(r[t]);return n[t*2]=e[t],n.join("")},O=e=>I(e,"raw")&&I(e,"length"),b=new WeakMap,w=e=>{const r=e.cache!==!1,n=r?e.cacheStore??b:void 0,t=e.newline!==void 0;function s(i,...o){if(O(i)){const l=i,N=o.length;if(l.length===1&&l[0]==="")return"";if(N===0){if(r&&n&&!t){const g=n.get(l);if(g)return g[0]}const f=u(l,!1,e);return r&&n&&n.set(l,f),f[0]}const _=(o[0]===s||o[0]===L)&&p.test(l[0])&&S.test(l[1]);let E;return r&&n&&!t&&(E=n.get(l)),E||(E=u(l,_,e),r&&n&&n.set(l,E)),m(E,_?o.slice(1):o)}return w(T(T({},e),i))}return T(s,{string(i){return i===""||!i?"":u([i],!1,e)[0]}})},L=w({cache:!0,newline:null,trimLeadingNewline:!0,trimTrailingNewline:!0}),j=L;export{j as outdent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class s{capacity;cache;constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const c=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,c),c}has(e){return this.cache.has(e)}set(e,c){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.capacity){const t=this.cache.keys().next().value;t!==void 0&&this.cache.delete(t)}this.cache.set(e,c)}delete(e){this.cache.delete(e)}clear(){this.cache.clear()}size(){return this.cache.size}}export{s as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=new Uint32Array(65536),q=(r,l)=>{const o=r.length,n=l.length,a=1<<o-1;let c=-1,d=0,p=o,h=o;for(;h--;)i[r.charCodeAt(h)]|=1<<h;for(h=0;h<n;h++){let A=i[l.charCodeAt(h)];const g=A|d;A|=(A&c)+c^c,d|=~(A|c),c&=A,d&a&&p++,c&a&&p--,d=d<<1|1,c=c<<1|~(g|d),d&=g}for(h=o;h--;)i[r.charCodeAt(h)]=0;return p},z=(r,l)=>{const o=l.length,n=r.length,a=[],c=[],d=Math.ceil(o/32),p=Math.ceil(n/32);for(let t=0;t<d;t++)c[t]=-1,a[t]=0;let h=0;for(;h<p-1;h++){let t=0,s=-1;const M=h*32,u=Math.min(32,n)+M;for(let e=M;e<u;e++)i[r.charCodeAt(e)]|=1<<e;for(let e=0;e<o;e++){const m=i[l.charCodeAt(e)],C=c[e/32|0]>>>e&1,f=a[e/32|0]>>>e&1,j=m|t,k=((m|f)&s)+s^s|m|f;let x=t|~(k|s),w=s&k;x>>>31^C&&(c[e/32|0]^=1<<e),w>>>31^f&&(a[e/32|0]^=1<<e),x=x<<1|C,w=w<<1|f,s=w|~(j|x),t=x&j}for(let e=M;e<u;e++)i[r.charCodeAt(e)]=0}let A=0,g=-1;const v=h*32,U=Math.min(32,n-v)+v;for(let t=v;t<U;t++)i[r.charCodeAt(t)]|=1<<t;let y=n;for(let t=0;t<o;t++){const s=i[l.charCodeAt(t)],M=c[t/32|0]>>>t&1,u=a[t/32|0]>>>t&1,e=s|A,m=((s|u)&g)+g^g|s|u;let C=A|~(m|g),f=g&m;y+=C>>>n-1&1,y-=f>>>n-1&1,C>>>31^M&&(c[t/32|0]^=1<<t),f>>>31^u&&(a[t/32|0]^=1<<t),C=C<<1|M,f=f<<1|u,g=f|~(e|C),A=C&e}for(let t=v;t<U;t++)i[r.charCodeAt(t)]=0;return y},I=(r,l)=>{if(r.length<l.length){const o=l;l=r,r=o}return l.length===0?r.length:r.length<=32?q(r,l):z(r,l)},_=(r,l)=>{let o=1/0,n=0;for(let a=0;a<l.length;a++){const c=I(r,l[a]);c<o&&(o=c,n=a)}return l[n]};export{_ as closest,I as distance};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{distance as d}from"./closest-C6YDQs4m.js";import{closest as y}from"./closest-C6YDQs4m.js";const g=(c,i,t)=>{const r=Array.from({length:t}).fill(1/0),s=Array.from({length:t}).fill(void 0);for(const n of i){const f=n;let e=d(c,f),l=f;for(let o=0;o<t;o+=1)if(e<r[o]){const a=r[o],m=s[o];r[o]=e,s[o]=l,e=a,l=m}}return s};export{y as closest,g as closestN,d as distance};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const R=String.raw,E=R`\p{Emoji}(?:\p{EMod}|[\u{E0020}-\u{E007E}]+\u{E007F}|\uFE0F?\u20E3?)`,a=()=>new RegExp(R`\p{RI}{2}|(?)${E}(?:\u200D${E})*`,"gu"),n=new Set(["\x1B",""]),e="\x07",_="[",r="m",u="]8;;",S=39,s=/[\u200B\uFEFF\u2060-\u2064]/g,I=new RegExp(`(?:\\${_}(?<code>\\d+)m|\\${u}(?<uri>.*)${e})`),i=Object.freeze(new Map([[0,0],[1,22],[2,22],[3,23],[4,24],[7,27],[8,28],[9,29],[30,39],[31,39],[32,39],[33,39],[34,39],[35,39],[36,39],[37,39],[40,49],[41,49],[42,49],[43,49],[44,49],[45,49],[46,49],[47,49],[90,39]])),t=/^[ \t]*(?:\r\n|\r|\n)/,N=/(?:\r\n|\r|\n)[ \t]*$/,g=/^(?:[\r\n]|$)/,c=/(?:\r\n|\r|\n)([ \t]*)(?:[^ \t\r\n]|$)/,T=/^[ \t]*[\r\n][ \t\r\n]*$/,L=/\r\n|\n|\r/g,w=/[\u001B\u009B](?:[[()#;?]{0,10}(?:\d{1,4}(?:;\d{0,4})*)?[0-9A-ORZcf-nqry=><]|\]8;;[^\u0007\u001B]{0,100}(?:\u0007|\u001B\\))/g,x=/\u001B\[(\d+(?:;\d+)*)?m[^\u001B]*(?:\u001B\[(?:\d+(?:;\d+)*)?m|$)/g,B=/\u001B\]8;[^\u0007\u001B]*(?:\u0007|\u001B\\)(.*?)\u001B\]8;;(?:\u0007|\u001B\\)/g,O=/[\u0000-\u0008\n-\u001F\u007F-\u009F]{1,1000}/y,A=a(),H=/[-_./\s]+/g,C=/(\u001B\[[0-9;]*[a-z])/i,G=new RegExp("\\p{Script=Arabic}","u"),M=new RegExp("\\p{Script=Bengali}","u"),D=new RegExp("\\p{Script=Cyrillic}","u"),K=new RegExp("\\p{Script=Devanagari}","u"),F=new RegExp("\\p{Script=Ethiopic}","u"),P=new RegExp("\\p{Script=Greek}","u"),d=new RegExp("\\p{Script=Greek}+|\\p{Script=Latin}+|[^\\p{Script=Greek}\\p{Script=Latin}]+","gu"),m=new RegExp("\\p{Script=Gujarati}","u"),l=new RegExp("\\p{Script=Gurmukhi}","u"),o=new RegExp("\\p{Script=Hangul}","u"),W=new RegExp("\\p{Script=Hebrew}","u"),$=new RegExp("\\p{Script=Hiragana}","u"),U=new RegExp("\\p{Script=Han}","u"),y=new RegExp("\\p{Script=Kannada}","u"),Y=new RegExp("\\p{Script=Katakana}","u"),h=new RegExp("\\p{Script=Khmer}","u"),k=new RegExp("\\p{Script=Lao}","u"),b=new RegExp("\\p{Script=Latin}","u"),j=new RegExp("\\p{Script=Malayalam}","u"),J=new RegExp("\\p{Script=Myanmar}","u"),V=new RegExp("\\p{Script=Oriya}","u"),f=new RegExp("\\p{Script=Sinhala}","u"),z=new RegExp("\\p{Script=Tamil}","u"),Z=new RegExp("\\p{Script=Telugu}","u"),q=new RegExp("\\p{Script=Thai}","u"),v=new RegExp("\\p{Script=Tibetan}","u"),Q=/[\u02BB\u02BC\u0027]/u,X=p=>p.replace(A,"");export{m as A,l as B,y as C,z as D,Z as E,j as F,f as G,q as H,k as I,v as J,J as K,F as L,h as M,V as N,n as O,r as P,u as Q,C as R,e as S,_ as T,I as U,i as V,S as W,s as X,t as a,N as b,T as c,g as d,L as e,c as f,w as g,O as h,A as i,x as j,B as k,H as l,D as m,b as n,P as o,d as p,Q as q,Y as r,X as s,U as t,$ as u,o as v,W as w,G as x,K as y,M as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=(c,r)=>{const n=String(c);if(typeof r!="string")throw new TypeError("Expected character");if(r.length===0)throw new TypeError("Expected non-empty substring");let e=0,t=n.indexOf(r);for(;t!==-1;){e++;const o=t+r.length;if(o<=t)break;t=n.indexOf(r,o)}return e};export{i as countOccurrences};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e="֑-߿יִ-﷽ﹰ-ﻼ",n="A-Za-zÀ-ÖØ-öø-ʸ̀-ࠀ-Ⰰ-︀--",o=new RegExp(`^[^${n}]*[${e}]`),s=new RegExp(`^[^${e}]*[${n}]`),c=(r="")=>{const t=r;return o.test(t)?"rtl":s.test(t)?"ltr":"neutral"};export{c as direction};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i,a,b as o,g as r}from"./lookup-DsIbtHWS.js";function t(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function u(e){return t(e),r(e)}function d(e,{ambiguousAsWide:s=!1}={}){return t(e),i(e)||a(e)||s&&o(e)?2:1}export{i as _isFullWidth,a as _isWide,d as eastAsianWidth,u as eastAsianWidthType};
|