@tempots/std 0.13.0 → 0.15.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.
- package/array.cjs +1 -1
- package/array.d.ts +35 -35
- package/array.js +109 -168
- package/async-result.cjs +1 -1
- package/async-result.d.ts +38 -15
- package/async-result.js +40 -5
- package/bigint.cjs +1 -1
- package/bigint.d.ts +20 -20
- package/bigint.js +37 -78
- package/boolean.cjs +1 -1
- package/boolean.d.ts +5 -5
- package/boolean.js +10 -19
- package/equal.cjs +1 -1
- package/equal.d.ts +3 -3
- package/equal.js +31 -37
- package/error.cjs +1 -0
- package/error.d.ts +24 -0
- package/error.js +26 -0
- package/function.cjs +1 -1
- package/function.d.ts +3 -3
- package/function.js +4 -10
- package/index.cjs +1 -1
- package/index.d.ts +1 -0
- package/index.js +120 -118
- package/number.cjs +1 -1
- package/number.d.ts +25 -46
- package/number.js +29 -86
- package/object.cjs +1 -1
- package/object.d.ts +6 -6
- package/object.js +12 -27
- package/package.json +15 -1
- package/promise.cjs +1 -0
- package/promise.d.ts +11 -0
- package/promise.js +9 -0
- package/regexp.cjs +1 -1
- package/regexp.d.ts +1 -1
- package/regexp.js +8 -8
- package/{result-Czm7RKNP.js → result-CGd0jCdl.js} +54 -19
- package/result-CdwVhaAc.cjs +1 -0
- package/result.cjs +1 -1
- package/result.d.ts +31 -8
- package/result.js +1 -1
- package/string.cjs +4 -4
- package/string.d.ts +85 -89
- package/string.js +193 -379
- package/validation.cjs +1 -1
- package/validation.d.ts +7 -7
- package/validation.js +1 -1
- package/result-DzdZiQoR.cjs +0 -1
package/string.d.ts
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* @returns The string with all occurrances of `placeholder` replaced by `replacement`.
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
export declare
|
|
15
|
+
export declare const replaceAll: (subject: string, placeholder: string, replacement: string) => string;
|
|
16
16
|
/**
|
|
17
|
-
* `
|
|
17
|
+
* `substringAfter` searches for the first occurrance of `searchFor` and returns the text after that.
|
|
18
18
|
* If `searchFor` is not found, an empty string is returned.
|
|
19
19
|
*
|
|
20
20
|
* @param value - The string to search in.
|
|
@@ -22,9 +22,9 @@ export declare function replaceAll(subject: string, placeholder: string, replace
|
|
|
22
22
|
* @returns The text after the first occurrance of `searchFor` or an empty string if `searchFor` is not found.
|
|
23
23
|
* @public
|
|
24
24
|
*/
|
|
25
|
-
export declare
|
|
25
|
+
export declare const substringAfter: (value: string, searchFor: string) => string;
|
|
26
26
|
/**
|
|
27
|
-
* `
|
|
27
|
+
* `substringAfterLast` searches for the last occurrance of `searchFor` and returns the text after that.
|
|
28
28
|
* If `searchFor` is not found, an empty string is returned.
|
|
29
29
|
*
|
|
30
30
|
* @param value - The string to search in.
|
|
@@ -32,9 +32,9 @@ export declare function afterText(value: string, searchFor: string): string;
|
|
|
32
32
|
* @returns The text after the last occurrance of `searchFor` or an empty string if `searchFor` is not found.
|
|
33
33
|
* @public
|
|
34
34
|
*/
|
|
35
|
-
export declare
|
|
35
|
+
export declare const substringAfterLast: (value: string, searchFor: string) => string;
|
|
36
36
|
/**
|
|
37
|
-
* `
|
|
37
|
+
* `substringBefore` searches for the first occurrance of `searchFor` and returns the text before that.
|
|
38
38
|
* If `searchFor` is not found, an empty string is returned.
|
|
39
39
|
*
|
|
40
40
|
* @param value - The string to search in.
|
|
@@ -42,9 +42,9 @@ export declare function afterLastText(value: string, searchFor: string): string;
|
|
|
42
42
|
* @returns The text before the first occurrance of `searchFor` or an empty string if `searchFor` is not found.
|
|
43
43
|
* @public
|
|
44
44
|
*/
|
|
45
|
-
export declare
|
|
45
|
+
export declare const substringBefore: (value: string, searchFor: string) => string;
|
|
46
46
|
/**
|
|
47
|
-
* `
|
|
47
|
+
* `substringBeforeLast` searches for the last occurrance of `searchFor` and returns the text before that.
|
|
48
48
|
* If `searchFor` is not found, an empty string is returned.
|
|
49
49
|
*
|
|
50
50
|
* @param value - The string to search in.
|
|
@@ -52,7 +52,7 @@ export declare function beforeText(value: string, searchFor: string): string;
|
|
|
52
52
|
* @returns The text before the last occurrance of `searchFor` or an empty string if `searchFor` is not found.
|
|
53
53
|
* @public
|
|
54
54
|
*/
|
|
55
|
-
export declare
|
|
55
|
+
export declare const substringBeforeLast: (value: string, searchFor: string) => string;
|
|
56
56
|
/**
|
|
57
57
|
* `capitalize` returns a string with the first character convert to upper case.
|
|
58
58
|
*
|
|
@@ -60,7 +60,7 @@ export declare function beforeLastText(value: string, searchFor: string): string
|
|
|
60
60
|
* @returns The capitalized string.
|
|
61
61
|
* @public
|
|
62
62
|
*/
|
|
63
|
-
export declare
|
|
63
|
+
export declare const capitalize: (s: string) => string;
|
|
64
64
|
/**
|
|
65
65
|
* Capitalize the first letter of every word in `value`. If `whiteSpaceOnly` is set to `true`
|
|
66
66
|
* the process is limited to whitespace separated words.
|
|
@@ -70,7 +70,7 @@ export declare function capitalize(s: string): string;
|
|
|
70
70
|
* @returns The string with the first letter of each word capitalized.
|
|
71
71
|
* @public
|
|
72
72
|
*/
|
|
73
|
-
export declare
|
|
73
|
+
export declare const capitalizeWords: (value: string, whiteSpaceOnly?: boolean) => string;
|
|
74
74
|
/**
|
|
75
75
|
* Replaces occurrances of `\r\n`, `\n\r`, `\r` with `\n`
|
|
76
76
|
*
|
|
@@ -78,7 +78,7 @@ export declare function capitalizeWords(value: string, whiteSpaceOnly?: boolean)
|
|
|
78
78
|
* @returns The string with normalized line endings.
|
|
79
79
|
* @public
|
|
80
80
|
*/
|
|
81
|
-
export declare
|
|
81
|
+
export declare const canonicalizeNewlines: (value: string) => string;
|
|
82
82
|
/**
|
|
83
83
|
* Compares two strings ignoring their case.
|
|
84
84
|
*
|
|
@@ -87,7 +87,7 @@ export declare function canonicalizeNewlines(value: string): string;
|
|
|
87
87
|
* @returns A negative number if `a` is less than `b`, zero if they are equal, or a positive number if `a` is greater than `b`.
|
|
88
88
|
* @public
|
|
89
89
|
*/
|
|
90
|
-
export declare
|
|
90
|
+
export declare const compareCaseInsensitive: (a: string, b: string) => number;
|
|
91
91
|
/**
|
|
92
92
|
* Checks if a string ends with a specified suffix.
|
|
93
93
|
*
|
|
@@ -96,7 +96,7 @@ export declare function compareCaseInsensitive(a: string, b: string): number;
|
|
|
96
96
|
* @returns `true` if the string ends with the specified suffix, `false` otherwise.
|
|
97
97
|
* @public
|
|
98
98
|
*/
|
|
99
|
-
export declare
|
|
99
|
+
export declare const stringEndsWith: (s: string, end: string) => boolean;
|
|
100
100
|
/**
|
|
101
101
|
* Checks if a string ends with another string in a case-insensitive manner.
|
|
102
102
|
*
|
|
@@ -105,7 +105,7 @@ export declare function textEndsWith(s: string, end: string): boolean;
|
|
|
105
105
|
* @returns `true` if `s` ends with `end` (case-insensitive), otherwise `false`.
|
|
106
106
|
* @public
|
|
107
107
|
*/
|
|
108
|
-
export declare
|
|
108
|
+
export declare const textEndsWithCaseInsensitive: (s: string, end: string) => boolean;
|
|
109
109
|
/**
|
|
110
110
|
* Checks if a string starts with a specified substring.
|
|
111
111
|
*
|
|
@@ -114,7 +114,7 @@ export declare function textEndsWithCaseInsensitive(s: string, end: string): boo
|
|
|
114
114
|
* @returns `true` if the string starts with the specified substring, `false` otherwise.
|
|
115
115
|
* @public
|
|
116
116
|
*/
|
|
117
|
-
export declare
|
|
117
|
+
export declare const stringStartsWith: (s: string, start: string) => boolean;
|
|
118
118
|
/**
|
|
119
119
|
* Checks if a string starts with another string in a case-insensitive manner.
|
|
120
120
|
*
|
|
@@ -123,7 +123,7 @@ export declare function textStartsWith(s: string, start: string): boolean;
|
|
|
123
123
|
* @returns `true` if `s` starts with `start` (case-insensitive), `false` otherwise.
|
|
124
124
|
* @public
|
|
125
125
|
*/
|
|
126
|
-
export declare
|
|
126
|
+
export declare const textStartsWithCaseInsensitive: (s: string, start: string) => boolean;
|
|
127
127
|
/**
|
|
128
128
|
* Compares a string `s` with many `values` and see if one of them matches its end ignoring their case.
|
|
129
129
|
*
|
|
@@ -132,7 +132,7 @@ export declare function textStartsWithCaseInsensitive(s: string, start: string):
|
|
|
132
132
|
* @returns `true` if `s` ends with any of the values in `values` (case-insensitive), `false` otherwise.
|
|
133
133
|
* @public
|
|
134
134
|
*/
|
|
135
|
-
export declare
|
|
135
|
+
export declare const textEndsWithAnyCaseInsensitive: (s: string, values: string[]) => boolean;
|
|
136
136
|
/**
|
|
137
137
|
* Compares a string `s` with many `values` and see if one of them matches its beginning ignoring their case.
|
|
138
138
|
*
|
|
@@ -141,7 +141,7 @@ export declare function textEndsWithAnyCaseInsensitive(s: string, values: string
|
|
|
141
141
|
* @returns `true` if `s` starts with any of the values in `values` (case-insensitive), `false` otherwise.
|
|
142
142
|
* @public
|
|
143
143
|
*/
|
|
144
|
-
export declare
|
|
144
|
+
export declare const textStartsWithAnyCaseInsensitive: (s: string, values: string[]) => boolean;
|
|
145
145
|
/**
|
|
146
146
|
* It cleans up all the whitespaces in the passed `value`. `collapse` does the following:
|
|
147
147
|
* - remove trailing/leading whitespaces
|
|
@@ -152,7 +152,7 @@ export declare function textStartsWithAnyCaseInsensitive(s: string, values: stri
|
|
|
152
152
|
* @returns The string with all whitespaces collapsed.
|
|
153
153
|
* @public
|
|
154
154
|
*/
|
|
155
|
-
export declare
|
|
155
|
+
export declare const collapseText: (value: string) => string;
|
|
156
156
|
/**
|
|
157
157
|
* It compares to string and it returns a negative number if `a` is inferior to `b`, zero if they are the same,
|
|
158
158
|
* or otherwise a positive non-sero number.
|
|
@@ -162,7 +162,7 @@ export declare function textCollapse(value: string): string;
|
|
|
162
162
|
* @returns A negative number if `a` is less than `b`, zero if they are equal, or a positive number if `a` is greater than `b`.
|
|
163
163
|
* @public
|
|
164
164
|
*/
|
|
165
|
-
export declare
|
|
165
|
+
export declare const compareStrings: (a: string, b: string) => number;
|
|
166
166
|
/**
|
|
167
167
|
* `textContainsCaseInsensitive` returns `true` if `s` contains one or more occurrences of `test` regardless of the text case.
|
|
168
168
|
*
|
|
@@ -171,7 +171,7 @@ export declare function compareStrings(a: string, b: string): number;
|
|
|
171
171
|
* @returns `true` if `s` contains `test` (case-insensitive), `false` otherwise.
|
|
172
172
|
* @public
|
|
173
173
|
*/
|
|
174
|
-
export declare
|
|
174
|
+
export declare const textContainsCaseInsensitive: (s: string, test: string) => boolean;
|
|
175
175
|
/**
|
|
176
176
|
* `textContains` returns `true` if `s` contains one or more occurrences of `test`.
|
|
177
177
|
*
|
|
@@ -180,7 +180,7 @@ export declare function textContainsCaseInsensitive(s: string, test: string): bo
|
|
|
180
180
|
* @returns `true` if `s` contains `test`, `false` otherwise.
|
|
181
181
|
* @public
|
|
182
182
|
*/
|
|
183
|
-
export declare
|
|
183
|
+
export declare const stringContains: (s: string, test: string) => boolean;
|
|
184
184
|
/**
|
|
185
185
|
* Return the number of occurrences of `test` in `s`.
|
|
186
186
|
*
|
|
@@ -189,7 +189,7 @@ export declare function textContains(s: string, test: string): boolean;
|
|
|
189
189
|
* @returns The number of occurrences of `test` in `s`.
|
|
190
190
|
* @public
|
|
191
191
|
*/
|
|
192
|
-
export declare
|
|
192
|
+
export declare const countStringOccurrences: (s: string, test: string) => number;
|
|
193
193
|
/**
|
|
194
194
|
* `containsAnyTextCaseInsensitive` returns `true` if `s` contains any of the strings in `tests` regardless of the text case
|
|
195
195
|
*
|
|
@@ -198,7 +198,7 @@ export declare function countTextOccurrences(s: string, test: string): number;
|
|
|
198
198
|
* @returns `true` if `s` contains any of the strings in `tests` (case-insensitive), `false` otherwise.
|
|
199
199
|
* @public
|
|
200
200
|
*/
|
|
201
|
-
export declare
|
|
201
|
+
export declare const containsAnyTextCaseInsensitive: (s: string, tests: string[]) => boolean;
|
|
202
202
|
/**
|
|
203
203
|
* `containsAnyText` returns `true` if `s` contains any of the strings in `tests`
|
|
204
204
|
*
|
|
@@ -207,7 +207,7 @@ export declare function containsAnyTextCaseInsensitive(s: string, tests: string[
|
|
|
207
207
|
* @returns `true` if `s` contains any of the strings in `tests`, `false` otherwise.
|
|
208
208
|
* @public
|
|
209
209
|
*/
|
|
210
|
-
export declare
|
|
210
|
+
export declare const containsAnyText: (s: string, tests: string[]) => boolean;
|
|
211
211
|
/**
|
|
212
212
|
* `containsAllTextCaseInsensitive` returns `true` if `s` contains all of the strings in `tests` regardless of the text case
|
|
213
213
|
*
|
|
@@ -216,7 +216,7 @@ export declare function containsAnyText(s: string, tests: string[]): boolean;
|
|
|
216
216
|
* @returns `true` if `s` contains all of the strings in `tests` (case-insensitive), `false` otherwise.
|
|
217
217
|
* @public
|
|
218
218
|
*/
|
|
219
|
-
export declare
|
|
219
|
+
export declare const containsAllTextCaseInsensitive: (s: string, tests: string[]) => boolean;
|
|
220
220
|
/**
|
|
221
221
|
* `containsAllText` returns `true` if `s` contains all of the strings in `tests`
|
|
222
222
|
*
|
|
@@ -225,7 +225,7 @@ export declare function containsAllTextCaseInsensitive(s: string, tests: string[
|
|
|
225
225
|
* @returns `true` if `s` contains all of the strings in `tests`, `false` otherwise.
|
|
226
226
|
* @public
|
|
227
227
|
*/
|
|
228
|
-
export declare
|
|
228
|
+
export declare const containsAllText: (s: string, tests: string[]) => boolean;
|
|
229
229
|
/**
|
|
230
230
|
* `dasherize` replaces all the occurrances of `_` with `-`
|
|
231
231
|
*
|
|
@@ -233,12 +233,11 @@ export declare function containsAllText(s: string, tests: string[]): boolean;
|
|
|
233
233
|
* @returns The dasherized string.
|
|
234
234
|
* @public
|
|
235
235
|
*/
|
|
236
|
-
export declare
|
|
236
|
+
export declare const dasherize: (s: string) => string;
|
|
237
237
|
/**
|
|
238
238
|
* Compares strings `a` and `b` and returns the position where they differ.
|
|
239
239
|
* If the strings are equal, it returns `-1`.
|
|
240
240
|
*
|
|
241
|
-
* @remarks
|
|
242
241
|
* @example
|
|
243
242
|
* ```ts
|
|
244
243
|
* stringsDifferAtIndex('abcdef', 'abc123') // returns 3
|
|
@@ -250,12 +249,11 @@ export declare function dasherize(s: string): string;
|
|
|
250
249
|
* @returns The position where the strings differ, or `-1` if they are equal.
|
|
251
250
|
*
|
|
252
251
|
*/
|
|
253
|
-
export declare
|
|
252
|
+
export declare const stringsDifferAtIndex: (a: string, b: string) => number;
|
|
254
253
|
/**
|
|
255
254
|
* `ellipsis` truncates `s` at len `maxlen` replaces the last characters with the content
|
|
256
255
|
* of `symbol`.
|
|
257
256
|
*
|
|
258
|
-
* @remarks
|
|
259
257
|
* @example
|
|
260
258
|
* ```ts
|
|
261
259
|
* ellipsis('tempo is a nice library', 9) // returns 'tempo is …'
|
|
@@ -267,11 +265,10 @@ export declare function stringsDifferAtIndex(a: string, b: string): number;
|
|
|
267
265
|
* @returns The truncated string.
|
|
268
266
|
* @public
|
|
269
267
|
*/
|
|
270
|
-
export declare
|
|
268
|
+
export declare const ellipsis: (s: string, maxlen?: number, symbol?: string) => string;
|
|
271
269
|
/**
|
|
272
270
|
* Same as `ellipsis` but puts the symbol in the middle of the string and not to the end.
|
|
273
271
|
*
|
|
274
|
-
* @remarks
|
|
275
272
|
* @example
|
|
276
273
|
* ```ts
|
|
277
274
|
* ellipsisMiddle('tempo is a nice library', 18) // returns 'tempo is … library'
|
|
@@ -283,7 +280,7 @@ export declare function ellipsis(s: string, maxlen?: number, symbol?: string): s
|
|
|
283
280
|
* @returns The truncated string.
|
|
284
281
|
* @public
|
|
285
282
|
*/
|
|
286
|
-
export declare
|
|
283
|
+
export declare const ellipsisMiddle: (s: string, maxlen?: number, symbol?: string) => string;
|
|
287
284
|
/**
|
|
288
285
|
* Returns `true` if `s` ends with any of the values in `values`.
|
|
289
286
|
*
|
|
@@ -292,7 +289,7 @@ export declare function ellipsisMiddle(s: string, maxlen?: number, symbol?: stri
|
|
|
292
289
|
* @returns `true` if `s` ends with any of the values in `values`, `false` otherwise.
|
|
293
290
|
* @public
|
|
294
291
|
*/
|
|
295
|
-
export declare
|
|
292
|
+
export declare const stringEndsWithAny: (s: string, values: string[]) => boolean;
|
|
296
293
|
/**
|
|
297
294
|
* `filterString` applies `predicate` character by character to `s` and it returns a filtered
|
|
298
295
|
* version of the string.
|
|
@@ -302,16 +299,16 @@ export declare function endsWithAnyText(s: string, values: string[]): boolean;
|
|
|
302
299
|
* @returns The filtered string.
|
|
303
300
|
* @public
|
|
304
301
|
*/
|
|
305
|
-
export declare
|
|
302
|
+
export declare const filterChars: (s: string, predicate: (s: string) => boolean) => string;
|
|
306
303
|
/**
|
|
307
|
-
* Same as `
|
|
304
|
+
* Same as `filterCharcodes` but `predicate` operates on integer char codes instead of string characters.
|
|
308
305
|
*
|
|
309
306
|
* @param s - The string to filter.
|
|
310
307
|
* @param predicate - The function to apply to each character code in the string.
|
|
311
308
|
* @returns The filtered string.
|
|
312
309
|
* @public
|
|
313
310
|
*/
|
|
314
|
-
export declare
|
|
311
|
+
export declare const filterCharcodes: (s: string, predicate: (n: number) => boolean) => string;
|
|
315
312
|
/**
|
|
316
313
|
* Calculates the hash code for a given string.
|
|
317
314
|
*
|
|
@@ -320,7 +317,7 @@ export declare function filterCharcode(s: string, predicate: (n: number) => bool
|
|
|
320
317
|
* @returns The calculated hash code as a number.
|
|
321
318
|
* @public
|
|
322
319
|
*/
|
|
323
|
-
export declare
|
|
320
|
+
export declare const stringHashCode: (value: string, seed?: number) => number;
|
|
324
321
|
/**
|
|
325
322
|
* Returns `true` if `value` is not `null` and contains at least one character.
|
|
326
323
|
*
|
|
@@ -328,7 +325,7 @@ export declare function stringHashCode(value: string, seed?: number): number;
|
|
|
328
325
|
* @returns `true` if the string is not `null` and contains at least one character, `false` otherwise.
|
|
329
326
|
* @public
|
|
330
327
|
*/
|
|
331
|
-
export declare
|
|
328
|
+
export declare const stringHasContent: (value: string) => boolean;
|
|
332
329
|
/**
|
|
333
330
|
* Works the same as `underscore` but also replaces underscores with whitespaces.
|
|
334
331
|
*
|
|
@@ -336,7 +333,7 @@ export declare function stringHasContent(value: string): boolean;
|
|
|
336
333
|
* @returns The converted string.
|
|
337
334
|
* @public
|
|
338
335
|
*/
|
|
339
|
-
export declare
|
|
336
|
+
export declare const humanize: (s: string) => string;
|
|
340
337
|
/**
|
|
341
338
|
* Checks if `s` contains only (and at least one) alphabetical characters.
|
|
342
339
|
*
|
|
@@ -344,7 +341,7 @@ export declare function humanize(s: string): string;
|
|
|
344
341
|
* @returns `true` if the string contains only alphabetical characters, `false` otherwise.
|
|
345
342
|
* @public
|
|
346
343
|
*/
|
|
347
|
-
export declare
|
|
344
|
+
export declare const isAlpha: (s: string) => boolean;
|
|
348
345
|
/**
|
|
349
346
|
* `isAlphaNum` returns `true` if the string only contains alpha-numeric characters.
|
|
350
347
|
*
|
|
@@ -352,7 +349,7 @@ export declare function isAlpha(s: string): boolean;
|
|
|
352
349
|
* @returns `true` if the string contains only alpha-numeric characters, `false` otherwise.
|
|
353
350
|
* @public
|
|
354
351
|
*/
|
|
355
|
-
export declare
|
|
352
|
+
export declare const isAlphaNum: (value: string) => boolean;
|
|
356
353
|
/**
|
|
357
354
|
* Checks if a string contains any breaking whitespace characters.
|
|
358
355
|
*
|
|
@@ -360,7 +357,7 @@ export declare function isAlphaNum(value: string): boolean;
|
|
|
360
357
|
* @returns `true` if the string contains breaking whitespace characters, `false` otherwise.
|
|
361
358
|
* @public
|
|
362
359
|
*/
|
|
363
|
-
export declare
|
|
360
|
+
export declare const isBreakingWhitespace: (value: string) => boolean;
|
|
364
361
|
/**
|
|
365
362
|
* Returns `true` if the value string is composed of only lower cased characters
|
|
366
363
|
* or case neutral characters.
|
|
@@ -369,7 +366,7 @@ export declare function isBreakingWhitespace(value: string): boolean;
|
|
|
369
366
|
* @returns `true` if the string contains only lower case characters, `false` otherwise.
|
|
370
367
|
* @public
|
|
371
368
|
*/
|
|
372
|
-
export declare
|
|
369
|
+
export declare const isLowerCase: (value: string) => boolean;
|
|
373
370
|
/**
|
|
374
371
|
* Returns `true` if the value string is composed of only upper cased characters
|
|
375
372
|
* or case neutral characters.
|
|
@@ -378,7 +375,7 @@ export declare function isLowerCase(value: string): boolean;
|
|
|
378
375
|
* @returns `true` if the string contains only upper case characters, `false` otherwise.
|
|
379
376
|
* @public
|
|
380
377
|
*/
|
|
381
|
-
export declare
|
|
378
|
+
export declare const isUpperCase: (value: string) => boolean;
|
|
382
379
|
/**
|
|
383
380
|
* `ifEmpty` returns `value` if it is neither `null` or empty, otherwise it returns `alt`
|
|
384
381
|
*
|
|
@@ -387,7 +384,7 @@ export declare function isUpperCase(value: string): boolean;
|
|
|
387
384
|
* @returns The original string if it is not `null` or empty, otherwise the alternative value.
|
|
388
385
|
* @public
|
|
389
386
|
*/
|
|
390
|
-
export declare
|
|
387
|
+
export declare const ifEmptyString: (value: string, alt: string) => string;
|
|
391
388
|
/**
|
|
392
389
|
* `isDigitsOnly` returns `true` if the string only contains digits.
|
|
393
390
|
*
|
|
@@ -395,7 +392,7 @@ export declare function ifEmptyString(value: string, alt: string): string;
|
|
|
395
392
|
* @returns `true` if the string contains only digits, `false` otherwise.
|
|
396
393
|
* @public
|
|
397
394
|
*/
|
|
398
|
-
export declare
|
|
395
|
+
export declare const isDigitsOnly: (value: string) => boolean;
|
|
399
396
|
/**
|
|
400
397
|
* `isEmpty` returns true if either `value` is null or is an empty string.
|
|
401
398
|
*
|
|
@@ -403,7 +400,7 @@ export declare function isDigitsOnly(value: string): boolean;
|
|
|
403
400
|
* @returns `true` if the string is `null` or empty, `false` otherwise.
|
|
404
401
|
* @public
|
|
405
402
|
*/
|
|
406
|
-
export declare
|
|
403
|
+
export declare const isEmptyString: (value: string) => boolean;
|
|
407
404
|
/**
|
|
408
405
|
* Convert first letter in `value` to lower case.
|
|
409
406
|
*
|
|
@@ -411,7 +408,7 @@ export declare function isEmptyString(value: string): boolean;
|
|
|
411
408
|
* @returns The string with the first letter in lower case.
|
|
412
409
|
* @public
|
|
413
410
|
*/
|
|
414
|
-
export declare
|
|
411
|
+
export declare const lowerCaseFirst: (value: string) => string;
|
|
415
412
|
/**
|
|
416
413
|
* Returns a random substring from the `value` argument. The length of such value is by default `1`.
|
|
417
414
|
*
|
|
@@ -420,7 +417,7 @@ export declare function lowerCaseFirst(value: string): string;
|
|
|
420
417
|
* @returns The random substring.
|
|
421
418
|
* @public
|
|
422
419
|
*/
|
|
423
|
-
export declare
|
|
420
|
+
export declare const randomString: (value: string, length?: number) => string;
|
|
424
421
|
/**
|
|
425
422
|
* Returns a random sampling of the specified length from the seed string.
|
|
426
423
|
*
|
|
@@ -429,7 +426,7 @@ export declare function randomString(value: string, length?: number): string;
|
|
|
429
426
|
* @returns The random string.
|
|
430
427
|
* @public
|
|
431
428
|
*/
|
|
432
|
-
export declare
|
|
429
|
+
export declare const randomStringSequence: (alphabet: string, length: number) => string;
|
|
433
430
|
/**
|
|
434
431
|
* Like `randomSequence`, but automatically uses the base64 sequence as the seed string.
|
|
435
432
|
*
|
|
@@ -437,7 +434,7 @@ export declare function randomStringSequence(alphabet: string, length: number):
|
|
|
437
434
|
* @returns The random string.
|
|
438
435
|
* @public
|
|
439
436
|
*/
|
|
440
|
-
export declare
|
|
437
|
+
export declare const randomStringSequenceBase64: (length: number) => string;
|
|
441
438
|
/**
|
|
442
439
|
* It maps a string character by character using `callback`.
|
|
443
440
|
*
|
|
@@ -446,7 +443,7 @@ export declare function randomStringSequenceBase64(length: number): string;
|
|
|
446
443
|
* @returns An array of the mapped characters.
|
|
447
444
|
* @public
|
|
448
445
|
*/
|
|
449
|
-
export declare
|
|
446
|
+
export declare const mapChars: <T>(callback: (c: string) => T, value: string) => T[];
|
|
450
447
|
/**
|
|
451
448
|
* If present, it removes all the occurrences of `toremove` from `value`.
|
|
452
449
|
*
|
|
@@ -455,7 +452,7 @@ export declare function mapChars<T>(callback: (c: string) => T, value: string):
|
|
|
455
452
|
* @returns The string with all occurrences of `toremove` removed.
|
|
456
453
|
* @public
|
|
457
454
|
*/
|
|
458
|
-
export declare
|
|
455
|
+
export declare const deleteSubstring: (value: string, toremove: string) => string;
|
|
459
456
|
/**
|
|
460
457
|
* If present, it removes the `toremove` text from the end of `value`.
|
|
461
458
|
*
|
|
@@ -464,7 +461,7 @@ export declare function removeFromString(value: string, toremove: string): strin
|
|
|
464
461
|
* @returns The string with the text removed.
|
|
465
462
|
* @public
|
|
466
463
|
*/
|
|
467
|
-
export declare
|
|
464
|
+
export declare const deleteStringAfter: (value: string, toremove: string) => string;
|
|
468
465
|
/**
|
|
469
466
|
* Removes a slice from `index` to `index + length` from `value`.
|
|
470
467
|
*
|
|
@@ -474,7 +471,7 @@ export declare function removeFromStringAfter(value: string, toremove: string):
|
|
|
474
471
|
* @returns The string with the slice removed.
|
|
475
472
|
* @public
|
|
476
473
|
*/
|
|
477
|
-
export declare
|
|
474
|
+
export declare const trimStringSlice: (value: string, index: number, length: number) => string;
|
|
478
475
|
/**
|
|
479
476
|
* If present, it removes the `toremove` text from the beginning of `value`.
|
|
480
477
|
*
|
|
@@ -483,7 +480,7 @@ export declare function removeSliceFromString(value: string, index: number, leng
|
|
|
483
480
|
* @returns The string with the text removed.
|
|
484
481
|
* @public
|
|
485
482
|
*/
|
|
486
|
-
export declare
|
|
483
|
+
export declare const deleteStringBefore: (value: string, toremove: string) => string;
|
|
487
484
|
/**
|
|
488
485
|
* If present, it removes the first occurrence of `toremove` from `value`.
|
|
489
486
|
*
|
|
@@ -492,11 +489,10 @@ export declare function removeFromStringBefore(value: string, toremove: string):
|
|
|
492
489
|
* @returns The string with the text removed.
|
|
493
490
|
* @public
|
|
494
491
|
*/
|
|
495
|
-
export declare
|
|
492
|
+
export declare const deleteFirstFromString: (value: string, toremove: string) => string;
|
|
496
493
|
/**
|
|
497
494
|
* `repeatString` builds a new string by repeating the argument `s`, n `times`.
|
|
498
495
|
*
|
|
499
|
-
* @remarks
|
|
500
496
|
* @example
|
|
501
497
|
* ```ts
|
|
502
498
|
* repeatString('Xy', 3) // generates 'XyXyXy'
|
|
@@ -507,7 +503,7 @@ export declare function removeFirstFromString(value: string, toremove: string):
|
|
|
507
503
|
* @returns The repeated string.
|
|
508
504
|
* @public
|
|
509
505
|
*/
|
|
510
|
-
export declare
|
|
506
|
+
export declare const repeatString: (s: string, times: number) => string;
|
|
511
507
|
/**
|
|
512
508
|
* Returns a new string whose characters are in reverse order.
|
|
513
509
|
*
|
|
@@ -515,7 +511,7 @@ export declare function repeatString(s: string, times: number): string;
|
|
|
515
511
|
* @returns The reversed string.
|
|
516
512
|
* @public
|
|
517
513
|
*/
|
|
518
|
-
export declare
|
|
514
|
+
export declare const reverseString: (s: string) => string;
|
|
519
515
|
/**
|
|
520
516
|
* Converts a string in a quoted string.
|
|
521
517
|
*
|
|
@@ -524,7 +520,7 @@ export declare function reverseString(s: string): string;
|
|
|
524
520
|
* @returns The quoted string.
|
|
525
521
|
* @public
|
|
526
522
|
*/
|
|
527
|
-
export declare
|
|
523
|
+
export declare const smartQuote: (s: string, prefer?: string) => string;
|
|
528
524
|
/**
|
|
529
525
|
* Returns a quoted version of the input string.
|
|
530
526
|
*
|
|
@@ -533,7 +529,7 @@ export declare function smartQuote(s: string, prefer?: string): string;
|
|
|
533
529
|
* @returns The quoted string.
|
|
534
530
|
* @public
|
|
535
531
|
*/
|
|
536
|
-
export declare
|
|
532
|
+
export declare const quote: (s: string, quoteChar?: string) => string;
|
|
537
533
|
/**
|
|
538
534
|
* Quotes a string for use in JavaScript code.
|
|
539
535
|
* If the string contains a newline character, it will be quoted using backticks.
|
|
@@ -544,7 +540,7 @@ export declare function quote(s: string, quoteChar?: string): string;
|
|
|
544
540
|
* @returns The quoted string.
|
|
545
541
|
* @public
|
|
546
542
|
*/
|
|
547
|
-
export declare
|
|
543
|
+
export declare const jsQuote: (s: string, prefer?: string) => string;
|
|
548
544
|
/**
|
|
549
545
|
* It only splits on the first occurrance of separator.
|
|
550
546
|
*
|
|
@@ -553,7 +549,7 @@ export declare function jsQuote(s: string, prefer?: string): string;
|
|
|
553
549
|
* @returns An array with the split string.
|
|
554
550
|
* @public
|
|
555
551
|
*/
|
|
556
|
-
export declare
|
|
552
|
+
export declare const splitStringOnce: (s: string, separator: string) => [string] | [string, string];
|
|
557
553
|
/**
|
|
558
554
|
* Returns `true` if `s` starts with any of the values in `values`.
|
|
559
555
|
*
|
|
@@ -562,7 +558,7 @@ export declare function splitStringOnce(s: string, separator: string): [string]
|
|
|
562
558
|
* @returns `true` if `s` starts with any of the values in `values`, `false` otherwise.
|
|
563
559
|
* @public
|
|
564
560
|
*/
|
|
565
|
-
export declare
|
|
561
|
+
export declare const stringStartsWithAny: (s: string, values: string[]) => boolean;
|
|
566
562
|
/**
|
|
567
563
|
* Surrounds a string with the contents of `left` and `right`. If `right` is omitted,
|
|
568
564
|
* `left` will be used on both sides
|
|
@@ -573,7 +569,7 @@ export declare function textStartsWithAny(s: string, values: string[]): boolean;
|
|
|
573
569
|
* @returns The surrounded string.
|
|
574
570
|
* @public
|
|
575
571
|
*/
|
|
576
|
-
export declare
|
|
572
|
+
export declare const surroundString: (s: string, left: string, right?: string) => string;
|
|
577
573
|
/**
|
|
578
574
|
* It transforms a string into an `Array` of characters.
|
|
579
575
|
*
|
|
@@ -581,7 +577,7 @@ export declare function surroundText(s: string, left: string, right?: string): s
|
|
|
581
577
|
* @returns An array of characters.
|
|
582
578
|
* @public
|
|
583
579
|
*/
|
|
584
|
-
export declare
|
|
580
|
+
export declare const stringToChars: (s: string) => string[];
|
|
585
581
|
/**
|
|
586
582
|
* It transforms a string into an `Array` of char codes in integer format.
|
|
587
583
|
*
|
|
@@ -589,7 +585,7 @@ export declare function stringToChars(s: string): string[];
|
|
|
589
585
|
* @returns An array of char codes.
|
|
590
586
|
* @public
|
|
591
587
|
*/
|
|
592
|
-
export declare
|
|
588
|
+
export declare const stringToCharcodes: (s: string) => number[];
|
|
593
589
|
/**
|
|
594
590
|
* Returns an array of `string` whose elements are equally long (using `len`). If the string `s`
|
|
595
591
|
* is not exactly divisible by `len` the last element of the array will be shorter.
|
|
@@ -599,7 +595,7 @@ export declare function stringToCharcodes(s: string): number[];
|
|
|
599
595
|
* @returns An array of chunks.
|
|
600
596
|
* @public
|
|
601
597
|
*/
|
|
602
|
-
export declare
|
|
598
|
+
export declare const chunkString: (s: string, len: number) => string[];
|
|
603
599
|
/**
|
|
604
600
|
* Returns an array of `string` split by line breaks.
|
|
605
601
|
*
|
|
@@ -607,7 +603,7 @@ export declare function chunkText(s: string, len: number): string[];
|
|
|
607
603
|
* @returns An array of lines.
|
|
608
604
|
* @public
|
|
609
605
|
*/
|
|
610
|
-
export declare
|
|
606
|
+
export declare const textToLines: (s: string) => string[];
|
|
611
607
|
/**
|
|
612
608
|
* `trimChars` removes from the beginning and the end of the string any character that is present in `charlist`.
|
|
613
609
|
*
|
|
@@ -616,7 +612,7 @@ export declare function stringToLines(s: string): string[];
|
|
|
616
612
|
* @returns The trimmed string.
|
|
617
613
|
* @public
|
|
618
614
|
*/
|
|
619
|
-
export declare
|
|
615
|
+
export declare const trimChars: (value: string, charlist: string) => string;
|
|
620
616
|
/**
|
|
621
617
|
* `trimCharsLeft` removes from the beginning of the string any character that is present in `charlist`.
|
|
622
618
|
*
|
|
@@ -625,7 +621,7 @@ export declare function trimChars(value: string, charlist: string): string;
|
|
|
625
621
|
* @returns The trimmed string.
|
|
626
622
|
* @public
|
|
627
623
|
*/
|
|
628
|
-
export declare
|
|
624
|
+
export declare const trimCharsLeft: (value: string, charlist: string) => string;
|
|
629
625
|
/**
|
|
630
626
|
* `trimCharsRight` removes from the end of the string any character that is present in `charlist`.
|
|
631
627
|
*
|
|
@@ -634,7 +630,7 @@ export declare function trimCharsLeft(value: string, charlist: string): string;
|
|
|
634
630
|
* @returns The trimmed string.
|
|
635
631
|
* @public
|
|
636
632
|
*/
|
|
637
|
-
export declare
|
|
633
|
+
export declare const trimCharsRight: (value: string, charlist: string) => string;
|
|
638
634
|
/**
|
|
639
635
|
* `underscore` finds UpperCase characters and turns them into LowerCase and prepends them with a whtiespace.
|
|
640
636
|
* Sequences of more than one UpperCase character are left untouched.
|
|
@@ -643,7 +639,7 @@ export declare function trimCharsRight(value: string, charlist: string): string;
|
|
|
643
639
|
* @returns The underscored string.
|
|
644
640
|
* @public
|
|
645
641
|
*/
|
|
646
|
-
export declare
|
|
642
|
+
export declare const underscore: (s: string) => string;
|
|
647
643
|
/**
|
|
648
644
|
* Convert first letter in `value` to upper case.
|
|
649
645
|
*
|
|
@@ -651,7 +647,7 @@ export declare function underscore(s: string): string;
|
|
|
651
647
|
* @returns The string with the first letter in upper case.
|
|
652
648
|
* @public
|
|
653
649
|
*/
|
|
654
|
-
export declare
|
|
650
|
+
export declare const upperCaseFirst: (value: string) => string;
|
|
655
651
|
/**
|
|
656
652
|
* `wrapColumns` splits a long string into lines that are at most `columns` long.
|
|
657
653
|
* Individual words whose length exceeds `columns` are not split.
|
|
@@ -663,7 +659,7 @@ export declare function upperCaseFirst(value: string): string;
|
|
|
663
659
|
* @returns The wrapped string.
|
|
664
660
|
* @public
|
|
665
661
|
*/
|
|
666
|
-
export declare
|
|
662
|
+
export declare const wrapColumns: (s: string, columns?: number, indent?: string, newline?: string) => string;
|
|
667
663
|
/**
|
|
668
664
|
* Checks if the character at the specified position in a string is a whitespace character.
|
|
669
665
|
*
|
|
@@ -672,25 +668,25 @@ export declare function wrapColumns(s: string, columns?: number, indent?: string
|
|
|
672
668
|
* @returns A boolean indicating whether the character at the specified position is a whitespace character.
|
|
673
669
|
* @public
|
|
674
670
|
*/
|
|
675
|
-
export declare
|
|
671
|
+
export declare const isSpaceAt: (s: string, pos: number) => boolean;
|
|
676
672
|
/**
|
|
677
673
|
* Encodes a string to base64.
|
|
678
674
|
*
|
|
679
675
|
* @param s - The string to encode.
|
|
680
676
|
* @returns The base64 encoded string.
|
|
681
|
-
* @throws
|
|
677
|
+
* @throws Throws `MissingImplementationError` if no implementation is found for base64 encoding.
|
|
682
678
|
* @public
|
|
683
679
|
*/
|
|
684
|
-
export declare
|
|
680
|
+
export declare const encodeBase64: (s: string) => string;
|
|
685
681
|
/**
|
|
686
682
|
* Decodes a base64 encoded string.
|
|
687
683
|
*
|
|
688
684
|
* @param s - The base64 encoded string to decode.
|
|
689
685
|
* @returns The decoded string.
|
|
690
|
-
* @throws
|
|
686
|
+
* @throws Throws a `MissingImplementationError` if no implementation is found for base64 decoding.
|
|
691
687
|
* @public
|
|
692
688
|
*/
|
|
693
|
-
export declare
|
|
689
|
+
export declare const decodeBase64: (s: string) => string;
|
|
694
690
|
/**
|
|
695
691
|
* Wraps a string into multiple lines based on the specified number of columns,
|
|
696
692
|
* indentation, and newline character.
|
|
@@ -702,7 +698,7 @@ export declare function decodeBase64(s: string): string;
|
|
|
702
698
|
* @returns The wrapped string.
|
|
703
699
|
* @public
|
|
704
700
|
*/
|
|
705
|
-
export declare
|
|
701
|
+
export declare const wrapLine: (s: string, columns: number, indent: string, newline: string) => string;
|
|
706
702
|
/**
|
|
707
703
|
* Pads a string on the left with a specified character until it reaches a specified length.
|
|
708
704
|
* If the string is already longer than the specified length, it is returned as is.
|
|
@@ -713,7 +709,7 @@ export declare function wrapLine(s: string, columns: number, indent: string, new
|
|
|
713
709
|
* @returns The padded string.
|
|
714
710
|
* @public
|
|
715
711
|
*/
|
|
716
|
-
export declare
|
|
712
|
+
export declare const lpad: (s: string, char: string, length: number) => string;
|
|
717
713
|
/**
|
|
718
714
|
* Pads a string on the right with a specified character until it reaches a specified length.
|
|
719
715
|
* If the string is already longer than the specified length, it is returned as is.
|
|
@@ -724,7 +720,7 @@ export declare function lpad(s: string, char: string, length: number): string;
|
|
|
724
720
|
* @returns The padded string.
|
|
725
721
|
* @public
|
|
726
722
|
*/
|
|
727
|
-
export declare
|
|
723
|
+
export declare const rpad: (s: string, char: string, length: number) => string;
|
|
728
724
|
/**
|
|
729
725
|
* Splits a string into two parts at the last occurrence of a specified substring.
|
|
730
726
|
* If the substring is found, the function returns an array with two elements:
|
|
@@ -737,7 +733,7 @@ export declare function rpad(s: string, char: string, length: number): string;
|
|
|
737
733
|
* @returns An array containing the split parts of the string.
|
|
738
734
|
* @public
|
|
739
735
|
*/
|
|
740
|
-
export declare
|
|
736
|
+
export declare const splitStringOnLast: (s: string, find: string) => [string] | [string, string];
|
|
741
737
|
/**
|
|
742
738
|
* Splits a string into two parts based on the first occurrence of a specified substring.
|
|
743
739
|
* If the substring is found, returns an array with two elements: the part of the string before the substring and the part after the substring.
|
|
@@ -748,4 +744,4 @@ export declare function splitOnLast(s: string, find: string): [string] | [string
|
|
|
748
744
|
* @returns An array containing the split parts of the string.
|
|
749
745
|
* @public
|
|
750
746
|
*/
|
|
751
|
-
export declare
|
|
747
|
+
export declare const splitStringOnFirst: (s: string, find: string) => [string] | [string, string];
|