string-filters 0.3.1 → 0.3.3

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.
@@ -1,72 +1,62 @@
1
- function a(r, e = !1) {
2
- let n = r.charAt(0).toUpperCase(), t = r.slice(1);
3
- return e && (t = t.toLowerCase()), `${n}${t}`;
4
- }
5
- function s(r, e = { numbers: !1, lower: !1 }) {
6
- let n = /[\p{L}]+/gu;
7
- typeof e.numbers < "u" && e.numbers && (n = /[\p{L}\p{N}]+/gu);
8
- let t = r.match(n);
9
- if (t.length <= 1)
10
- return null;
11
- let l = t.shift();
12
- const u = typeof e.lower < "u" ? e.lower : !1;
13
- return u && (l = l.toLowerCase()), t = t.map((f) => a(f, u)), t.unshift(l), t.join("");
14
- }
15
- function o(r, e = !1) {
16
- let n = e ? /[\p{L}\p{N}]+/gu : /[\p{L}]+/gu, t = r.match(n);
17
- return t.length <= 1 ? null : t.map((l) => l.toLowerCase()).join("");
18
- }
19
- function p(r, e = !1) {
20
- let n = e ? /[\p{L}\p{N}-]+/gu : /[\p{L}-]+/gu, t = r.match(n);
21
- return t.length <= 1 ? null : t.map((l) => l.toLowerCase()).join("-");
22
- }
23
- function i(r, e, n = " ") {
24
- const t = Math.floor((e - r.length) / 2) + r.length;
25
- return r.padStart(t, n).padEnd(e, n);
26
- }
27
- function w(r, e = { numbers: !1, lower: !1 }) {
28
- let n = /[\p{L}]+/gu;
29
- typeof e.numbers < "u" && e.numbers && (n = /[\p{L}\p{N}]+/gu);
30
- let t = r.match(n);
31
- if (t.length <= 1)
32
- return null;
33
- const l = typeof e.lower < "u" ? e.lower : !1;
34
- return t.map((u) => a(u, l)).join("");
35
- }
36
- function c(r, e = !1) {
37
- let n = e ? /[\p{L}\p{N}_]+/gu : /[\p{L}_]+/gu, t = r.match(n);
38
- return t.length <= 1 ? null : t.map((l) => l.toLowerCase()).join("_");
39
- }
40
- function d(r, e = { numbers: !1, lower: !1 }) {
41
- let n = /[\p{L}]+/gu;
42
- typeof e.numbers < "u" && e.numbers && (n = /[\p{L}\p{N}]+/gu);
43
- let t = r.match(n);
44
- if (t.length <= 1)
45
- return null;
46
- const l = typeof e.lower < "u" ? e.lower : !1;
47
- return t.map((u) => a(u, l)).join(" ");
48
- }
49
- function m(r, e = { numbers: !1, lower: !1 }) {
50
- let n = /[\p{L}-]+/gu;
51
- typeof e.numbers < "u" && e.numbers && (n = /[\p{L}\p{N}-]+/gu);
52
- let t = r.match(n);
53
- if (t.length <= 1)
54
- return null;
55
- const l = typeof e.lower < "u" ? e.lower : !1;
56
- return t.map((u) => a(u, l)).join("-");
57
- }
58
- function g(r, e = 32, n = "...") {
59
- return r.substring(0, e) + n;
1
+ /*!
2
+ * String Filters v0.3.3
3
+ * Homepage (https://github.com/tarkhov/js-string-filters)
4
+ * Copyright 2026 Tarkhov
5
+ * License: MIT
6
+ */
7
+ function l(n, t = !1) {
8
+ let r = n.charAt(0).toUpperCase(), e = n.slice(1);
9
+ return t && (e = e.toLowerCase()), `${r}${e}`;
10
+ }
11
+ function o(n, t = { numbers: !1, lower: !1 }) {
12
+ const r = t?.numbers ? /[\p{L}\p{N}]+/gu : new RegExp("\\p{L}+", "gu");
13
+ let e = n.match(r);
14
+ if (e.length <= 1) return null;
15
+ let a = e.shift();
16
+ const u = t?.lower;
17
+ return u && (a = a.toLowerCase()), e = e.map((s) => l(s, u)), e.unshift(a), e.join("");
18
+ }
19
+ function p(n, t = !1) {
20
+ let r = t ? /[\p{L}\p{N}]+/gu : new RegExp("\\p{L}+", "gu"), e = n.match(r);
21
+ return e.length <= 1 ? null : e.map((a) => a.toLowerCase()).join("");
22
+ }
23
+ function f(n, t = !1) {
24
+ let r = t ? /[\p{L}\p{N}-]+/gu : /[\p{L}-]+/gu, e = n.match(r);
25
+ return e.length <= 1 ? null : e.map((a) => a.toLowerCase()).join("-");
26
+ }
27
+ function i(n, t, r = " ") {
28
+ const e = Math.floor((t - n.length) / 2) + n.length;
29
+ return n.padStart(e, r).padEnd(t, r);
30
+ }
31
+ function c(n, t = { numbers: !1, lower: !1 }) {
32
+ const r = t?.numbers ? /[\p{L}\p{N}]+/gu : new RegExp("\\p{L}+", "gu");
33
+ let e = n.match(r);
34
+ return e.length <= 1 ? null : e.map((a) => l(a, t?.lower)).join("");
35
+ }
36
+ function g(n, t = !1) {
37
+ let r = t ? /[\p{L}\p{N}_]+/gu : /[\p{L}_]+/gu, e = n.match(r);
38
+ return e.length <= 1 ? null : e.map((a) => a.toLowerCase()).join("_");
39
+ }
40
+ function m(n, t = !1) {
41
+ return n.replace(new RegExp("\\p{L}+", "gu"), (r) => l(r, t));
42
+ }
43
+ function L(n, t = { numbers: !1, lower: !1 }) {
44
+ const r = t?.numbers ? /[\p{L}\p{N}-]+/gu : /[\p{L}-]+/gu;
45
+ let e = n.match(r);
46
+ return e.length <= 1 ? null : e.map((a) => l(a, t?.lower)).join("-");
47
+ }
48
+ function w(n, t = 32, r = "...") {
49
+ return n.substring(0, t) + r;
60
50
  }
61
51
  export {
62
- s as camelCase,
63
- a as capitalize,
64
- o as flatCase,
65
- p as kebabCase,
52
+ o as camelCase,
53
+ l as capitalize,
54
+ p as flatCase,
55
+ f as kebabCase,
66
56
  i as pad,
67
- w as pascalCase,
68
- c as snakeCase,
69
- d as titleCase,
70
- m as trainCase,
71
- g as truncate
57
+ c as pascalCase,
58
+ g as snakeCase,
59
+ m as titleCase,
60
+ L as trainCase,
61
+ w as truncate
72
62
  };
@@ -1 +1,7 @@
1
- (function(r,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(r=typeof globalThis<"u"?globalThis:r||self,u(r.StringFilters={}))})(this,(function(r){"use strict";function u(l,e=!1){let n=l.charAt(0).toUpperCase(),t=l.slice(1);return e&&(t=t.toLowerCase()),`${n}${t}`}function s(l,e={numbers:!1,lower:!1}){let n=/[\p{L}]+/gu;typeof e.numbers<"u"&&e.numbers&&(n=/[\p{L}\p{N}]+/gu);let t=l.match(n);if(t.length<=1)return null;let a=t.shift();const f=typeof e.lower<"u"?e.lower:!1;return f&&(a=a.toLowerCase()),t=t.map(h=>u(h,f)),t.unshift(a),t.join("")}function i(l,e=!1){let n=e?/[\p{L}\p{N}]+/gu:/[\p{L}]+/gu,t=l.match(n);return t.length<=1?null:t.map(a=>a.toLowerCase()).join("")}function o(l,e=!1){let n=e?/[\p{L}\p{N}-]+/gu:/[\p{L}-]+/gu,t=l.match(n);return t.length<=1?null:t.map(a=>a.toLowerCase()).join("-")}function d(l,e,n=" "){const t=Math.floor((e-l.length)/2)+l.length;return l.padStart(t,n).padEnd(e,n)}function p(l,e={numbers:!1,lower:!1}){let n=/[\p{L}]+/gu;typeof e.numbers<"u"&&e.numbers&&(n=/[\p{L}\p{N}]+/gu);let t=l.match(n);if(t.length<=1)return null;const a=typeof e.lower<"u"?e.lower:!1;return t.map(f=>u(f,a)).join("")}function c(l,e=!1){let n=e?/[\p{L}\p{N}_]+/gu:/[\p{L}_]+/gu,t=l.match(n);return t.length<=1?null:t.map(a=>a.toLowerCase()).join("_")}function m(l,e={numbers:!1,lower:!1}){let n=/[\p{L}]+/gu;typeof e.numbers<"u"&&e.numbers&&(n=/[\p{L}\p{N}]+/gu);let t=l.match(n);if(t.length<=1)return null;const a=typeof e.lower<"u"?e.lower:!1;return t.map(f=>u(f,a)).join(" ")}function w(l,e={numbers:!1,lower:!1}){let n=/[\p{L}-]+/gu;typeof e.numbers<"u"&&e.numbers&&(n=/[\p{L}\p{N}-]+/gu);let t=l.match(n);if(t.length<=1)return null;const a=typeof e.lower<"u"?e.lower:!1;return t.map(f=>u(f,a)).join("-")}function g(l,e=32,n="..."){return l.substring(0,e)+n}r.camelCase=s,r.capitalize=u,r.flatCase=i,r.kebabCase=o,r.pad=d,r.pascalCase=p,r.snakeCase=c,r.titleCase=m,r.trainCase=w,r.truncate=g,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));
1
+ /*!
2
+ * String Filters v0.3.3
3
+ * Homepage (https://github.com/tarkhov/js-string-filters)
4
+ * Copyright 2026 Tarkhov
5
+ * License: MIT
6
+ */
7
+ (function(l,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(l=typeof globalThis<"u"?globalThis:l||self,u(l.StringFilters={}))})(this,(function(l){"use strict";function u(n,t=!1){let a=n.charAt(0).toUpperCase(),e=n.slice(1);return t&&(e=e.toLowerCase()),`${a}${e}`}function f(n,t={numbers:!1,lower:!1}){const a=t?.numbers?/[\p{L}\p{N}]+/gu:new RegExp("\\p{L}+","gu");let e=n.match(a);if(e.length<=1)return null;let r=e.shift();const s=t?.lower;return s&&(r=r.toLowerCase()),e=e.map(C=>u(C,s)),e.unshift(r),e.join("")}function i(n,t=!1){let a=t?/[\p{L}\p{N}]+/gu:new RegExp("\\p{L}+","gu"),e=n.match(a);return e.length<=1?null:e.map(r=>r.toLowerCase()).join("")}function o(n,t=!1){let a=t?/[\p{L}\p{N}-]+/gu:/[\p{L}-]+/gu,e=n.match(a);return e.length<=1?null:e.map(r=>r.toLowerCase()).join("-")}function p(n,t,a=" "){const e=Math.floor((t-n.length)/2)+n.length;return n.padStart(e,a).padEnd(t,a)}function c(n,t={numbers:!1,lower:!1}){const a=t?.numbers?/[\p{L}\p{N}]+/gu:new RegExp("\\p{L}+","gu");let e=n.match(a);return e.length<=1?null:e.map(r=>u(r,t?.lower)).join("")}function m(n,t=!1){let a=t?/[\p{L}\p{N}_]+/gu:/[\p{L}_]+/gu,e=n.match(a);return e.length<=1?null:e.map(r=>r.toLowerCase()).join("_")}function d(n,t=!1){return n.replace(new RegExp("\\p{L}+","gu"),a=>u(a,t))}function g(n,t={numbers:!1,lower:!1}){const a=t?.numbers?/[\p{L}\p{N}-]+/gu:/[\p{L}-]+/gu;let e=n.match(a);return e.length<=1?null:e.map(r=>u(r,t?.lower)).join("-")}function h(n,t=32,a="..."){return n.substring(0,t)+a}l.camelCase=f,l.capitalize=u,l.flatCase=i,l.kebabCase=o,l.pad=p,l.pascalCase=c,l.snakeCase=m,l.titleCase=d,l.trainCase=g,l.truncate=h,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-filters",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Fast native javascript string filters library.",
5
5
  "type": "module",
6
6
  "files": [
@@ -45,6 +45,7 @@
45
45
  "preview": "vite preview"
46
46
  },
47
47
  "devDependencies": {
48
- "vite": "^7.3.1"
48
+ "vite": "^7.3.1",
49
+ "vite-plugin-banner": "^0.8.1"
49
50
  }
50
51
  }