@zinaid/str 0.0.6 → 0.0.7
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/dist/ascii/index.d.ts +5 -0
- package/dist/ascii/index.d.ts.map +1 -1
- package/dist/base64/index.d.ts +16 -0
- package/dist/base64/index.d.ts.map +1 -1
- package/dist/base64/index.js +52 -51
- package/dist/convertcase/index.d.ts +10 -0
- package/dist/convertcase/index.d.ts.map +1 -1
- package/dist/index.js +106 -105
- package/dist/markdown/index.d.ts +23 -0
- package/dist/markdown/index.d.ts.map +1 -1
- package/dist/pluralizer/index.d.ts +61 -0
- package/dist/pluralizer/index.d.ts.map +1 -1
- package/dist/pluralizer/index.js +36 -27
- package/dist/replacer/index.d.ts +14 -14
- package/dist/str.d.ts +300 -60
- package/dist/str.d.ts.map +1 -1
- package/dist/str.js +182 -198
- package/dist/stringable/index.d.ts +398 -1
- package/dist/stringable/index.d.ts.map +1 -1
- package/dist/stringable/index.js +400 -13
- package/dist/transliterate/index.d.ts +5 -0
- package/dist/transliterate/index.d.ts.map +1 -1
- package/dist/trimmer/index.d.ts +21 -0
- package/dist/trimmer/index.d.ts.map +1 -1
- package/dist/ulid/index.d.ts +38 -0
- package/dist/ulid/index.d.ts.map +1 -1
- package/dist/ulid/index.js +37 -29
- package/dist/uuid/index.d.ts +34 -0
- package/dist/uuid/index.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pluralizer/index.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,MAAM,WAAW,eAAe;IAC5B,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAoDD
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pluralizer/index.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,MAAM,WAAW,eAAe;IAC5B,WAAW,EAAE,MAAM,EAAE,CAAC;CACzB;AAoDD;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,MAAM,CAKrE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,MAAM,CAErE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAClB,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAU,EACjB,YAAY,GAAE,OAAe,GAC9B,MAAM,CAKR;AAqBD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAI9C;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElD;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAEpD;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,GAAE,MAAW,GAAG,OAAO,CAEtD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAiBnE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,IAAI,OAAO,SAAS,CAU5C"}
|
package/dist/pluralizer/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { format as
|
|
2
|
-
import { isUndefined as
|
|
3
|
-
import
|
|
4
|
-
let
|
|
1
|
+
import { format as s } from "@zinaid/num";
|
|
2
|
+
import { isUndefined as l } from "@zinaid/utils";
|
|
3
|
+
import f from "pluralize";
|
|
4
|
+
let t;
|
|
5
5
|
const o = {
|
|
6
6
|
uncountable: [
|
|
7
7
|
"audio",
|
|
@@ -49,42 +49,51 @@ const o = {
|
|
|
49
49
|
"wheat"
|
|
50
50
|
]
|
|
51
51
|
};
|
|
52
|
-
function
|
|
53
|
-
|
|
52
|
+
function c(e, n = 2) {
|
|
53
|
+
const r = e.split(/(?=[A-Z])/), a = String(r.pop());
|
|
54
|
+
return r.join("") + p(a, n);
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
-
|
|
56
|
+
function h(e, n = 2) {
|
|
57
|
+
return c(e, n);
|
|
58
|
+
}
|
|
59
|
+
function p(e, n = 2, r = !1) {
|
|
60
|
+
return (r ? s(n) + " " : "") + d(e, n);
|
|
61
|
+
}
|
|
62
|
+
function d(e, n) {
|
|
63
|
+
if (Math.abs(n) === 1 || m(e))
|
|
57
64
|
return e;
|
|
58
|
-
const
|
|
59
|
-
return u(
|
|
65
|
+
const r = i().plural(e);
|
|
66
|
+
return u(r, e);
|
|
60
67
|
}
|
|
61
|
-
function
|
|
62
|
-
const n =
|
|
68
|
+
function C(e) {
|
|
69
|
+
const n = i().singular(e);
|
|
63
70
|
return u(n, e);
|
|
64
71
|
}
|
|
65
|
-
function
|
|
72
|
+
function m(e) {
|
|
66
73
|
return o.uncountable.includes(e.toLowerCase());
|
|
67
74
|
}
|
|
68
|
-
function
|
|
69
|
-
return
|
|
75
|
+
function U(e = "") {
|
|
76
|
+
return i().isPlural(e);
|
|
70
77
|
}
|
|
71
|
-
function
|
|
72
|
-
return
|
|
78
|
+
function k(e = "") {
|
|
79
|
+
return i().isSingular(e);
|
|
73
80
|
}
|
|
74
81
|
function u(e, n) {
|
|
75
82
|
return n.toLowerCase() === n ? e.toLowerCase() : n.toUpperCase() === n ? e.toUpperCase() : n[0] && n[0].toUpperCase() + n.slice(1) === n ? (e[0] ?? "").toUpperCase() + e.slice(1) : e;
|
|
76
83
|
}
|
|
77
|
-
function
|
|
78
|
-
return
|
|
79
|
-
(e) =>
|
|
80
|
-
)),
|
|
84
|
+
function i() {
|
|
85
|
+
return l(t) && (t = f, o.uncountable.forEach(
|
|
86
|
+
(e) => t.addUncountableRule(e)
|
|
87
|
+
)), t;
|
|
81
88
|
}
|
|
82
89
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
i as inflector,
|
|
91
|
+
U as isPlural,
|
|
92
|
+
k as isSingular,
|
|
86
93
|
u as matchCase,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
c as
|
|
94
|
+
p as plural,
|
|
95
|
+
h as pluralPascal,
|
|
96
|
+
c as pluralStudly,
|
|
97
|
+
C as singular,
|
|
98
|
+
m as uncountable
|
|
90
99
|
};
|
package/dist/replacer/index.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns the portion of the string specified by the start and length parameters.
|
|
3
3
|
*
|
|
4
|
-
* @param string
|
|
5
|
-
* @param start
|
|
6
|
-
* @param length
|
|
7
|
-
* @returns
|
|
4
|
+
* @param string - The input string.
|
|
5
|
+
* @param start - The starting position. If negative, it starts that many characters from the end of the string.
|
|
6
|
+
* @param length - The number of characters to return. If omitted or null, returns all characters from start to the end of the string. If negative, omits that many characters from the end.
|
|
7
|
+
* @returns The extracted substring.
|
|
8
8
|
*/
|
|
9
9
|
export declare function substr(string: string, start: number, length?: number | null): string;
|
|
10
10
|
/**
|
|
11
11
|
* Returns the number of substring occurrences.
|
|
12
12
|
*
|
|
13
|
-
* @param haystack
|
|
14
|
-
* @param needle
|
|
15
|
-
* @param offset
|
|
16
|
-
* @param length
|
|
17
|
-
* @returns
|
|
13
|
+
* @param haystack - The string to search within.
|
|
14
|
+
* @param needle - The substring to count.
|
|
15
|
+
* @param offset - The starting position for the search. If negative, it starts that many characters from the end of the string.
|
|
16
|
+
* @param length - The length of the segment to search within. If omitted or null, searches to the end of the string. If negative, omits that many characters from the end.
|
|
17
|
+
* @returns The number of occurrences of the substring within the specified segment.
|
|
18
18
|
*/
|
|
19
19
|
export declare function substrCount(haystack: string, needle: string, offset?: number, length?: number | null): number;
|
|
20
20
|
/**
|
|
21
21
|
* Replace text within a portion of a string.
|
|
22
22
|
* Properly handles multibyte characters.
|
|
23
23
|
*
|
|
24
|
-
* @param value
|
|
25
|
-
* @param replace
|
|
26
|
-
* @param offset
|
|
27
|
-
* @param length
|
|
28
|
-
* @returns
|
|
24
|
+
* @param value - The original string.
|
|
25
|
+
* @param replace - The replacement string or an array of replacement strings.
|
|
26
|
+
* @param offset - The starting position for the replacement. If negative, it starts that many characters from the end of the string.
|
|
27
|
+
* @param length - The number of characters to replace. If omitted or null, replaces all characters from offset to the end of the string. If negative, omits that many characters from the end.
|
|
28
|
+
* @returns The modified string or an array of modified strings if multiple replacements are provided.
|
|
29
29
|
*/
|
|
30
30
|
export declare function substrReplace(value: string, replace: string | string[], offset?: number | number[], length?: number | number[] | null): string | string[];
|
|
31
31
|
//# sourceMappingURL=index.d.ts.map
|