string-filters 0.3.0 → 0.3.2

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,58 @@
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
+ function a(n, t = !1) {
2
+ let r = n.charAt(0).toUpperCase(), e = n.slice(1);
3
+ return t && (e = e.toLowerCase()), `${r}${e}`;
4
+ }
5
+ function o(n, t = { numbers: !1, lower: !1 }) {
6
+ const r = t?.numbers ? /[\p{L}\p{N}]+/gu : /[\p{L}]+/gu;
7
+ let e = n.match(r);
8
+ if (e.length <= 1) return null;
9
+ let l = e.shift();
10
+ const u = t?.lower;
11
+ return u && (l = l.toLowerCase()), e = e.map((s) => a(s, u)), e.unshift(l), e.join("");
12
+ }
13
+ function p(n, t = !1) {
14
+ let r = t ? /[\p{L}\p{N}]+/gu : /[\p{L}]+/gu, e = n.match(r);
15
+ return e.length <= 1 ? null : e.map((l) => l.toLowerCase()).join("");
16
+ }
17
+ function f(n, t = !1) {
18
+ let r = t ? /[\p{L}\p{N}-]+/gu : /[\p{L}-]+/gu, e = n.match(r);
19
+ return e.length <= 1 ? null : e.map((l) => l.toLowerCase()).join("-");
20
+ }
21
+ function i(n, t, r = " ") {
22
+ const e = Math.floor((t - n.length) / 2) + n.length;
23
+ return n.padStart(e, r).padEnd(t, r);
24
+ }
25
+ function c(n, t = { numbers: !1, lower: !1 }) {
26
+ const r = t?.numbers ? /[\p{L}\p{N}]+/gu : /[\p{L}]+/gu;
27
+ let e = n.match(r);
28
+ return e.length <= 1 ? null : e.map((l) => a(l, t?.lower)).join("");
29
+ }
30
+ function m(n, t = !1) {
31
+ let r = t ? /[\p{L}\p{N}_]+/gu : /[\p{L}_]+/gu, e = n.match(r);
32
+ return e.length <= 1 ? null : e.map((l) => l.toLowerCase()).join("_");
33
+ }
34
+ function g(n, t = { numbers: !1, lower: !1 }) {
35
+ const r = t?.numbers ? /[\p{L}\p{N}]+/gu : /[\p{L}]+/gu;
36
+ let e = n.match(r);
37
+ return e.length <= 1 ? null : e.map((l) => a(l, t?.lower)).join(" ");
38
+ }
39
+ function w(n, t = { numbers: !1, lower: !1 }) {
40
+ const r = t?.numbers ? /[\p{L}\p{N}-]+/gu : /[\p{L}-]+/gu;
41
+ let e = n.match(r);
42
+ return e.length <= 1 ? null : e.map((l) => a(l, t?.lower)).join("-");
43
+ }
44
+ function L(n, t = 32, r = "...") {
45
+ return n.substring(0, t) + r;
60
46
  }
61
47
  export {
62
- s as camelCase,
48
+ o as camelCase,
63
49
  a as capitalize,
64
- o as flatCase,
65
- p as kebabCase,
50
+ p as flatCase,
51
+ f as kebabCase,
66
52
  i as pad,
67
- w as pascalCase,
68
- c as snakeCase,
69
- d as titleCase,
70
- m as trainCase,
71
- g as truncate
53
+ c as pascalCase,
54
+ m as snakeCase,
55
+ g as titleCase,
56
+ w as trainCase,
57
+ L as truncate
72
58
  };
@@ -1 +1 @@
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
+ (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(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:/[\p{L}]+/gu;let e=n.match(a);if(e.length<=1)return null;let l=e.shift();const s=t?.lower;return s&&(l=l.toLowerCase()),e=e.map(w=>u(w,s)),e.unshift(l),e.join("")}function i(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(l=>l.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(l=>l.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:/[\p{L}]+/gu;let e=n.match(a);return e.length<=1?null:e.map(l=>u(l,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(l=>l.toLowerCase()).join("_")}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(l=>u(l,t?.lower)).join(" ")}function d(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(l=>u(l,t?.lower)).join("-")}function h(n,t=32,a="..."){return n.substring(0,t)+a}r.camelCase=f,r.capitalize=u,r.flatCase=i,r.kebabCase=o,r.pad=p,r.pascalCase=c,r.snakeCase=m,r.titleCase=g,r.trainCase=d,r.truncate=h,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,11 +1,9 @@
1
1
  {
2
2
  "name": "string-filters",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Fast native javascript string filters library.",
5
5
  "type": "module",
6
- "files": [
7
- "dist"
8
- ],
6
+ "files": ["dist"],
9
7
  "main": "./dist/string-filters.umd.cjs",
10
8
  "module": "./dist/string-filters.js",
11
9
  "exports": {