@visulima/string 1.2.3 → 1.4.0

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.
Files changed (102) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +46 -0
  3. package/dist/case/camel-case.cjs +1 -59
  4. package/dist/case/camel-case.mjs +1 -57
  5. package/dist/case/capital-case.cjs +1 -51
  6. package/dist/case/capital-case.mjs +1 -49
  7. package/dist/case/constant-case.cjs +1 -11
  8. package/dist/case/constant-case.mjs +1 -9
  9. package/dist/case/dot-case.cjs +1 -11
  10. package/dist/case/dot-case.mjs +1 -9
  11. package/dist/case/flat-case.cjs +1 -11
  12. package/dist/case/flat-case.mjs +1 -9
  13. package/dist/case/flip-case.cjs +1 -61
  14. package/dist/case/flip-case.mjs +1 -57
  15. package/dist/case/identify-case.cjs +1 -69
  16. package/dist/case/identify-case.mjs +1 -67
  17. package/dist/case/index.cjs +1 -47
  18. package/dist/case/index.mjs +1 -20
  19. package/dist/case/kebab-case.cjs +1 -61
  20. package/dist/case/kebab-case.mjs +1 -57
  21. package/dist/case/lower-first.cjs +1 -13
  22. package/dist/case/lower-first.mjs +1 -11
  23. package/dist/case/no-case.cjs +1 -11
  24. package/dist/case/no-case.mjs +1 -9
  25. package/dist/case/pascal-case.cjs +1 -52
  26. package/dist/case/pascal-case.mjs +1 -50
  27. package/dist/case/pascal-snake-case.cjs +1 -32
  28. package/dist/case/pascal-snake-case.mjs +1 -30
  29. package/dist/case/path-case.cjs +1 -11
  30. package/dist/case/path-case.mjs +1 -9
  31. package/dist/case/sentence-case.cjs +1 -58
  32. package/dist/case/sentence-case.mjs +1 -56
  33. package/dist/case/snake-case.cjs +1 -11
  34. package/dist/case/snake-case.mjs +1 -9
  35. package/dist/case/split-by-case.cjs +1 -641
  36. package/dist/case/split-by-case.mjs +1 -637
  37. package/dist/case/title-case.cjs +1 -47
  38. package/dist/case/title-case.mjs +1 -45
  39. package/dist/case/train-case.cjs +1 -44
  40. package/dist/case/train-case.mjs +1 -42
  41. package/dist/case/upper-first.cjs +1 -13
  42. package/dist/case/upper-first.mjs +1 -11
  43. package/dist/get-string-truncated-width.cjs +1 -422
  44. package/dist/get-string-truncated-width.mjs +1 -418
  45. package/dist/get-string-width.cjs +1 -11
  46. package/dist/get-string-width.mjs +1 -7
  47. package/dist/index.cjs +1 -66
  48. package/dist/index.d.cts +13 -3
  49. package/dist/index.d.mts +13 -3
  50. package/dist/index.d.ts +13 -3
  51. package/dist/index.mjs +1 -29
  52. package/dist/outdent.cjs +1 -125
  53. package/dist/outdent.mjs +1 -121
  54. package/dist/packem_shared/LRUCache-Bjo6gsbC.mjs +1 -0
  55. package/dist/packem_shared/LRUCache-TYqfUYE5.cjs +1 -0
  56. package/dist/packem_shared/WrapMode-BZ3jkEf1.mjs +8 -0
  57. package/dist/packem_shared/WrapMode-DR7vv3px.cjs +8 -0
  58. package/dist/packem_shared/alignText-BCKbnqhC.mjs +2 -0
  59. package/dist/packem_shared/alignText-CLZJuPP6.cjs +2 -0
  60. package/dist/packem_shared/constants-Cd17VNEv.mjs +1 -0
  61. package/dist/packem_shared/constants-D3K8u3G8.cjs +1 -0
  62. package/dist/packem_shared/generate-cache-key-BZf0GiMs.cjs +1 -0
  63. package/dist/packem_shared/generate-cache-key-DPByFaMH.mjs +1 -0
  64. package/dist/packem_shared/joinSegments-CDHNMXsF.cjs +1 -0
  65. package/dist/packem_shared/joinSegments-H7QJ7rwJ.mjs +1 -0
  66. package/dist/packem_shared/normalize-german-eszett-4k1qRtEP.mjs +1 -0
  67. package/dist/packem_shared/normalize-german-eszett-Bop4wOp9.cjs +1 -0
  68. package/dist/packem_shared/replaceString-Ce8TI_-L.cjs +1 -0
  69. package/dist/packem_shared/replaceString-D7R-5VFX.mjs +1 -0
  70. package/dist/packem_shared/slugify-B1vlQQO1.mjs +1 -0
  71. package/dist/packem_shared/slugify-CH3GI7E5.cjs +1 -0
  72. package/dist/packem_shared/transliterate-BXaP38Sh.mjs +5 -0
  73. package/dist/packem_shared/transliterate-CToQ-aeM.cjs +5 -0
  74. package/dist/slice.cjs +1 -419
  75. package/dist/slice.mjs +1 -415
  76. package/dist/test/utils.cjs +13 -74
  77. package/dist/test/utils.mjs +14 -69
  78. package/dist/test/vitest.cjs +1 -11
  79. package/dist/test/vitest.mjs +1 -7
  80. package/dist/truncate.cjs +1 -101
  81. package/dist/truncate.mjs +1 -97
  82. package/dist/utils.cjs +1 -65
  83. package/dist/utils.mjs +1 -56
  84. package/package.json +8 -1
  85. package/dist/packem_shared/LRUCache-Crb-m7cw.cjs +0 -53
  86. package/dist/packem_shared/LRUCache-udNErhWw.mjs +0 -51
  87. package/dist/packem_shared/WrapMode-BCVbMqYK.mjs +0 -545
  88. package/dist/packem_shared/WrapMode-DebG_Nll.cjs +0 -550
  89. package/dist/packem_shared/constants-6-GJ6zA-.cjs +0 -150
  90. package/dist/packem_shared/constants-CKdlkHVU.mjs +0 -99
  91. package/dist/packem_shared/generate-cache-key-D8f1auDB.cjs +0 -10
  92. package/dist/packem_shared/generate-cache-key-YSju5pj2.mjs +0 -8
  93. package/dist/packem_shared/joinSegments-BfSDBmPF.mjs +0 -46
  94. package/dist/packem_shared/joinSegments-HYXurfoq.cjs +0 -48
  95. package/dist/packem_shared/normalize-german-eszett-DJK0S2qj.cjs +0 -11
  96. package/dist/packem_shared/normalize-german-eszett-fpJ4lZL6.mjs +0 -9
  97. package/dist/packem_shared/replaceString-C7Dp5vAg.mjs +0 -200
  98. package/dist/packem_shared/replaceString-iYo1cDfZ.cjs +0 -202
  99. package/dist/packem_shared/slugify-SKjCL8DF.cjs +0 -50
  100. package/dist/packem_shared/slugify-pbxTlzeQ.mjs +0 -48
  101. package/dist/packem_shared/transliterate-4P32b49d.mjs +0 -47780
  102. package/dist/packem_shared/transliterate-CtOTNpLs.cjs +0 -47782
@@ -1,47 +1 @@
1
- 'use strict';
2
-
3
- const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
4
- const case_splitByCase = require('./split-by-case.cjs');
5
- const case_upperFirst = require('./upper-first.cjs');
6
- const generateCacheKey = require('../packem_shared/generate-cache-key-D8f1auDB.cjs');
7
- const normalizeGermanEszett = require('../packem_shared/normalize-german-eszett-DJK0S2qj.cjs');
8
-
9
- var __defProp = Object.defineProperty;
10
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
- const defaultCacheStore = new LRUCache(1e3);
12
- function titleCase(value, options) {
13
- if (typeof value !== "string") {
14
- return "";
15
- }
16
- const shouldCache = options?.cache ?? false;
17
- const cacheStore = options?.cacheStore ?? defaultCacheStore;
18
- let cacheKey;
19
- if (shouldCache) {
20
- cacheKey = generateCacheKey.generateCacheKey(value, options);
21
- }
22
- if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
23
- return cacheStore.get(cacheKey);
24
- }
25
- const result = case_splitByCase.splitByCase(value, {
26
- handleAnsi: options?.handleAnsi,
27
- handleEmoji: options?.handleEmoji,
28
- knownAcronyms: options?.knownAcronyms,
29
- locale: options?.locale,
30
- normalize: options?.normalize,
31
- separators: void 0,
32
- stripAnsi: options?.stripAnsi,
33
- stripEmoji: options?.stripEmoji
34
- }).map((word) => {
35
- if (options?.locale?.startsWith("de")) {
36
- word = normalizeGermanEszett.normalizeGermanEszett(word);
37
- }
38
- return case_upperFirst(options?.locale ? word.toLocaleLowerCase(options.locale) : word.toLowerCase(), { locale: options?.locale });
39
- }).join(" ");
40
- if (shouldCache && cacheKey) {
41
- cacheStore.set(cacheKey, result);
42
- }
43
- return result;
44
- }
45
- __name(titleCase, "titleCase");
46
-
47
- module.exports = titleCase;
1
+ "use strict";var c=Object.defineProperty;var i=(r,e)=>c(r,"name",{value:e,configurable:!0});const u=require("../packem_shared/LRUCache-TYqfUYE5.cjs"),p=require("./split-by-case.cjs"),m=require("./upper-first.cjs"),h=require("../packem_shared/generate-cache-key-BZf0GiMs.cjs"),d=require("../packem_shared/normalize-german-eszett-Bop4wOp9.cjs");var f=Object.defineProperty,y=i((r,e)=>f(r,"name",{value:e,configurable:!0}),"n");const C=new u(1e3);function l(r,e){if(typeof r!="string")return"";const o=e?.cache??!1,t=e?.cacheStore??C;let a;if(o&&(a=h.a(r,e)),o&&a&&t.has(a))return t.get(a);const n=p.splitByCase(r,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(s=>(e?.locale?.startsWith("de")&&(s=d.l(s)),m(e?.locale?s.toLocaleLowerCase(e.locale):s.toLowerCase(),{locale:e?.locale}))).join(" ");return o&&a&&t.set(a,n),n}i(l,"d");y(l,"titleCase");module.exports=l;
@@ -1,45 +1 @@
1
- import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
2
- import { splitByCase } from './split-by-case.mjs';
3
- import upperFirst from './upper-first.mjs';
4
- import { g as generateCacheKey } from '../packem_shared/generate-cache-key-YSju5pj2.mjs';
5
- import { n as normalizeGermanEszett } from '../packem_shared/normalize-german-eszett-fpJ4lZL6.mjs';
6
-
7
- var __defProp = Object.defineProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- const defaultCacheStore = new LRUCache(1e3);
10
- function titleCase(value, options) {
11
- if (typeof value !== "string") {
12
- return "";
13
- }
14
- const shouldCache = options?.cache ?? false;
15
- const cacheStore = options?.cacheStore ?? defaultCacheStore;
16
- let cacheKey;
17
- if (shouldCache) {
18
- cacheKey = generateCacheKey(value, options);
19
- }
20
- if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
21
- return cacheStore.get(cacheKey);
22
- }
23
- const result = splitByCase(value, {
24
- handleAnsi: options?.handleAnsi,
25
- handleEmoji: options?.handleEmoji,
26
- knownAcronyms: options?.knownAcronyms,
27
- locale: options?.locale,
28
- normalize: options?.normalize,
29
- separators: void 0,
30
- stripAnsi: options?.stripAnsi,
31
- stripEmoji: options?.stripEmoji
32
- }).map((word) => {
33
- if (options?.locale?.startsWith("de")) {
34
- word = normalizeGermanEszett(word);
35
- }
36
- return upperFirst(options?.locale ? word.toLocaleLowerCase(options.locale) : word.toLowerCase(), { locale: options?.locale });
37
- }).join(" ");
38
- if (shouldCache && cacheKey) {
39
- cacheStore.set(cacheKey, result);
40
- }
41
- return result;
42
- }
43
- __name(titleCase, "titleCase");
44
-
45
- export { titleCase as default };
1
+ var s=Object.defineProperty;var n=(r,o)=>s(r,"name",{value:o,configurable:!0});import c from"../packem_shared/LRUCache-Bjo6gsbC.mjs";import{splitByCase as m}from"./split-by-case.mjs";import p from"./upper-first.mjs";import{a as f}from"../packem_shared/generate-cache-key-DPByFaMH.mjs";import{l as d}from"../packem_shared/normalize-german-eszett-4k1qRtEP.mjs";var h=Object.defineProperty,u=n((r,o)=>h(r,"name",{value:o,configurable:!0}),"n");const j=new c(1e3);function A(r,o){if(typeof r!="string")return"";const a=o?.cache??!1,i=o?.cacheStore??j;let t;if(a&&(t=f(r,o)),a&&t&&i.has(t))return i.get(t);const l=m(r,{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(e=>(o?.locale?.startsWith("de")&&(e=d(e)),p(o?.locale?e.toLocaleLowerCase(o.locale):e.toLowerCase(),{locale:o?.locale}))).join(" ");return a&&t&&i.set(t,l),l}n(A,"d");u(A,"titleCase");export{A as default};
@@ -1,44 +1 @@
1
- 'use strict';
2
-
3
- const LRUCache = require('../packem_shared/LRUCache-Crb-m7cw.cjs');
4
- const case_splitByCase = require('./split-by-case.cjs');
5
- const case_upperFirst = require('./upper-first.cjs');
6
- const generateCacheKey = require('../packem_shared/generate-cache-key-D8f1auDB.cjs');
7
- const joinSegments = require('../packem_shared/joinSegments-HYXurfoq.cjs');
8
-
9
- var __defProp = Object.defineProperty;
10
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
- const defaultCacheStore = new LRUCache(1e3);
12
- const trainCase = /* @__PURE__ */ __name((value, options) => {
13
- if (typeof value !== "string") {
14
- return "";
15
- }
16
- const shouldCache = options?.cache ?? false;
17
- const cacheStore = options?.cacheStore ?? defaultCacheStore;
18
- let cacheKey;
19
- if (shouldCache) {
20
- cacheKey = generateCacheKey.generateCacheKey(value, options);
21
- }
22
- if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
23
- return cacheStore.get(cacheKey);
24
- }
25
- const result = joinSegments(
26
- case_splitByCase.splitByCase(value, {
27
- handleAnsi: options?.handleAnsi,
28
- handleEmoji: options?.handleEmoji,
29
- knownAcronyms: options?.knownAcronyms,
30
- locale: options?.locale,
31
- normalize: options?.normalize,
32
- separators: void 0,
33
- stripAnsi: options?.stripAnsi,
34
- stripEmoji: options?.stripEmoji
35
- }).map((p) => case_upperFirst(p, { locale: options?.locale })),
36
- "-"
37
- );
38
- if (shouldCache && cacheKey) {
39
- cacheStore.set(cacheKey, result);
40
- }
41
- return result;
42
- }, "trainCase");
43
-
44
- module.exports = trainCase;
1
+ "use strict";var c=Object.defineProperty;var a=(r,e)=>c(r,"name",{value:e,configurable:!0});const l=require("../packem_shared/LRUCache-TYqfUYE5.cjs"),p=require("./split-by-case.cjs"),u=require("./upper-first.cjs"),m=require("../packem_shared/generate-cache-key-BZf0GiMs.cjs"),h=require("../packem_shared/joinSegments-CDHNMXsF.cjs");var d=Object.defineProperty,y=a((r,e)=>d(r,"name",{value:e,configurable:!0}),"i");const f=new l(1e3),j=y((r,e)=>{if(typeof r!="string")return"";const s=e?.cache??!1,i=e?.cacheStore??f;let n;if(s&&(n=m.a(r,e)),s&&n&&i.has(n))return i.get(n);const t=h(p.splitByCase(r,{handleAnsi:e?.handleAnsi,handleEmoji:e?.handleEmoji,knownAcronyms:e?.knownAcronyms,locale:e?.locale,normalize:e?.normalize,separators:void 0,stripAnsi:e?.stripAnsi,stripEmoji:e?.stripEmoji}).map(o=>u(o,{locale:e?.locale})),"-");return s&&n&&i.set(n,t),t},"trainCase");module.exports=j;
@@ -1,42 +1 @@
1
- import LRUCache from '../packem_shared/LRUCache-udNErhWw.mjs';
2
- import { splitByCase } from './split-by-case.mjs';
3
- import upperFirst from './upper-first.mjs';
4
- import { g as generateCacheKey } from '../packem_shared/generate-cache-key-YSju5pj2.mjs';
5
- import joinSegments from '../packem_shared/joinSegments-BfSDBmPF.mjs';
6
-
7
- var __defProp = Object.defineProperty;
8
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
- const defaultCacheStore = new LRUCache(1e3);
10
- const trainCase = /* @__PURE__ */ __name((value, options) => {
11
- if (typeof value !== "string") {
12
- return "";
13
- }
14
- const shouldCache = options?.cache ?? false;
15
- const cacheStore = options?.cacheStore ?? defaultCacheStore;
16
- let cacheKey;
17
- if (shouldCache) {
18
- cacheKey = generateCacheKey(value, options);
19
- }
20
- if (shouldCache && cacheKey && cacheStore.has(cacheKey)) {
21
- return cacheStore.get(cacheKey);
22
- }
23
- const result = joinSegments(
24
- splitByCase(value, {
25
- handleAnsi: options?.handleAnsi,
26
- handleEmoji: options?.handleEmoji,
27
- knownAcronyms: options?.knownAcronyms,
28
- locale: options?.locale,
29
- normalize: options?.normalize,
30
- separators: void 0,
31
- stripAnsi: options?.stripAnsi,
32
- stripEmoji: options?.stripEmoji
33
- }).map((p) => upperFirst(p, { locale: options?.locale })),
34
- "-"
35
- );
36
- if (shouldCache && cacheKey) {
37
- cacheStore.set(cacheKey, result);
38
- }
39
- return result;
40
- }, "trainCase");
41
-
42
- export { trainCase as default };
1
+ var m=Object.defineProperty;var e=(o,r)=>m(o,"name",{value:r,configurable:!0});import l from"../packem_shared/LRUCache-Bjo6gsbC.mjs";import{splitByCase as p}from"./split-by-case.mjs";import c from"./upper-first.mjs";import{a as f}from"../packem_shared/generate-cache-key-DPByFaMH.mjs";import d from"../packem_shared/joinSegments-H7QJ7rwJ.mjs";var h=Object.defineProperty,u=e((o,r)=>h(o,"name",{value:r,configurable:!0}),"i");const A=new l(1e3),b=u((o,r)=>{if(typeof o!="string")return"";const n=r?.cache??!1,i=r?.cacheStore??A;let t;if(n&&(t=f(o,r)),n&&t&&i.has(t))return i.get(t);const a=d(p(o,{handleAnsi:r?.handleAnsi,handleEmoji:r?.handleEmoji,knownAcronyms:r?.knownAcronyms,locale:r?.locale,normalize:r?.normalize,separators:void 0,stripAnsi:r?.stripAnsi,stripEmoji:r?.stripEmoji}).map(s=>c(s,{locale:r?.locale})),"-");return n&&t&&i.set(t,a),a},"trainCase");export{b as default};
@@ -1,13 +1 @@
1
- 'use strict';
2
-
3
- var __defProp = Object.defineProperty;
4
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
5
- const upperFirst = /* @__PURE__ */ __name((value, options) => {
6
- if (typeof value !== "string" || value === "") {
7
- return "";
8
- }
9
- const firstChar = options?.locale ? value[0].toLocaleUpperCase(options.locale) : value[0].toUpperCase();
10
- return firstChar + value.slice(1);
11
- }, "upperFirst");
12
-
13
- module.exports = upperFirst;
1
+ "use strict";var o=Object.defineProperty;var a=(e,t)=>o(e,"name",{value:t,configurable:!0});var p=Object.defineProperty,s=a((e,t)=>p(e,"name",{value:t,configurable:!0}),"s");const r=s((e,t)=>typeof e!="string"||e===""?"":(t?.locale?e[0].toLocaleUpperCase(t.locale):e[0].toUpperCase())+e.slice(1),"upperFirst");module.exports=r;
@@ -1,11 +1 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
- const upperFirst = /* @__PURE__ */ __name((value, options) => {
4
- if (typeof value !== "string" || value === "") {
5
- return "";
6
- }
7
- const firstChar = options?.locale ? value[0].toLocaleUpperCase(options.locale) : value[0].toUpperCase();
8
- return firstChar + value.slice(1);
9
- }, "upperFirst");
10
-
11
- export { upperFirst as default };
1
+ var p=Object.defineProperty;var o=(e,a)=>p(e,"name",{value:a,configurable:!0});var t=Object.defineProperty,l=o((e,a)=>t(e,"name",{value:a,configurable:!0}),"s");const s=l((e,a)=>typeof e!="string"||e===""?"":(a?.locale?e[0].toLocaleUpperCase(a.locale):e[0].toUpperCase())+e.slice(1),"upperFirst");export{s as default};