typeshi 1.7.13 → 1.7.14
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.
|
@@ -40,14 +40,14 @@ export declare function stringContainsAnyOf(s: string, substrings: string | stri
|
|
|
40
40
|
* - **`false`** `otherwise`.
|
|
41
41
|
*/
|
|
42
42
|
export declare function equivalentAlphanumericStrings(s1: string, s2: string, tolerance?: number): boolean;
|
|
43
|
-
export declare
|
|
43
|
+
export declare namespace Str {
|
|
44
44
|
/**
|
|
45
45
|
* @param s `string`
|
|
46
46
|
* @param prefixes `string | string[] | RegExp` possible starting string(s).
|
|
47
47
|
* @param flags `RegExpFlagsEnum[] (Optional)` regex flags to use when creating the {@link RegExp} object. see {@link RegExpFlagsEnum}
|
|
48
48
|
* @returns **`true`** if the string starts with any of the prefixes, **`false`** otherwise.
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
const startsWith: typeof stringStartsWithAnyOf;
|
|
51
51
|
/**
|
|
52
52
|
* Checks if a string ends with any of the specified suffixes.
|
|
53
53
|
* @param s `string`
|
|
@@ -55,14 +55,14 @@ export declare class StringOperation {
|
|
|
55
55
|
* @param flags `RegExpFlagsEnum[] (Optional)` regex flags to use when creating the {@link RegExp} object. see {@link RegExpFlagsEnum}
|
|
56
56
|
* @returns **`true`** if the string ends with any of the suffixes, **`false`** otherwise.
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
const endsWith: typeof stringEndsWithAnyOf;
|
|
59
59
|
/**
|
|
60
|
-
* @param s `string`
|
|
61
|
-
* @param substrings `string | string[] | RegExp
|
|
60
|
+
* @param s `string`
|
|
61
|
+
* @param substrings `string | string[] | RegExp`
|
|
62
62
|
* @param flags `RegExpFlagsEnum[] (Optional)` regex flags to use when creating the {@link RegExp} object. see {@link RegExpFlagsEnum}
|
|
63
63
|
* @returns **`true`** if the string contains any of the substrings, **`false`** otherwise.
|
|
64
64
|
*/
|
|
65
|
-
|
|
65
|
+
const contains: typeof stringContainsAnyOf;
|
|
66
66
|
/**
|
|
67
67
|
* Ignores case by default:
|
|
68
68
|
* - converts `s1` & `s2` to lowercase and removes all non-alphanumeric characters from both strings,
|
|
@@ -75,7 +75,7 @@ export declare class StringOperation {
|
|
|
75
75
|
* - **`true`** `if` the two alphanumeric strings are equivalent,
|
|
76
76
|
* - **`false`** `otherwise`.
|
|
77
77
|
*/
|
|
78
|
-
|
|
78
|
+
const equivalentAlphanumeric: typeof equivalentAlphanumericStrings;
|
|
79
79
|
}
|
|
80
80
|
/** for simple regular expressions...
|
|
81
81
|
* so like not ones that have parentheses, pipes, or curly braced numbers */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Str = void 0;
|
|
4
4
|
exports.stringEndsWithAnyOf = stringEndsWithAnyOf;
|
|
5
5
|
exports.stringStartsWithAnyOf = stringStartsWithAnyOf;
|
|
6
6
|
exports.stringContainsAnyOf = stringContainsAnyOf;
|
|
@@ -173,44 +173,44 @@ function equivalentAlphanumericStrings(s1, s2, tolerance = 0.90) {
|
|
|
173
173
|
}
|
|
174
174
|
return false;
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
176
|
+
var Str;
|
|
177
|
+
(function (Str) {
|
|
178
|
+
/**
|
|
179
|
+
* @param s `string`
|
|
180
|
+
* @param prefixes `string | string[] | RegExp` possible starting string(s).
|
|
181
|
+
* @param flags `RegExpFlagsEnum[] (Optional)` regex flags to use when creating the {@link RegExp} object. see {@link RegExpFlagsEnum}
|
|
182
|
+
* @returns **`true`** if the string starts with any of the prefixes, **`false`** otherwise.
|
|
183
|
+
*/
|
|
184
|
+
Str.startsWith = stringStartsWithAnyOf;
|
|
185
|
+
/**
|
|
186
|
+
* Checks if a string ends with any of the specified suffixes.
|
|
187
|
+
* @param s `string`
|
|
188
|
+
* @param suffixes `string | string[] | RegExp` possible ending strings.
|
|
189
|
+
* @param flags `RegExpFlagsEnum[] (Optional)` regex flags to use when creating the {@link RegExp} object. see {@link RegExpFlagsEnum}
|
|
190
|
+
* @returns **`true`** if the string ends with any of the suffixes, **`false`** otherwise.
|
|
191
|
+
*/
|
|
192
|
+
Str.endsWith = stringEndsWithAnyOf;
|
|
193
|
+
/**
|
|
194
|
+
* @param s `string`
|
|
195
|
+
* @param substrings `string | string[] | RegExp`
|
|
196
|
+
* @param flags `RegExpFlagsEnum[] (Optional)` regex flags to use when creating the {@link RegExp} object. see {@link RegExpFlagsEnum}
|
|
197
|
+
* @returns **`true`** if the string contains any of the substrings, **`false`** otherwise.
|
|
198
|
+
*/
|
|
199
|
+
Str.contains = stringContainsAnyOf;
|
|
200
|
+
/**
|
|
201
|
+
* Ignores case by default:
|
|
202
|
+
* - converts `s1` & `s2` to lowercase and removes all non-alphanumeric characters from both strings,
|
|
203
|
+
* - sorts the characters in both strings,
|
|
204
|
+
* - then compares the two strings for equivalence.
|
|
205
|
+
* @param s1 `string`
|
|
206
|
+
* @param s2 `string`
|
|
207
|
+
* @param tolerance `number` - a number between 0 and 1, default is `0.90`
|
|
208
|
+
* @returns **`boolean`**
|
|
209
|
+
* - **`true`** `if` the two alphanumeric strings are equivalent,
|
|
210
|
+
* - **`false`** `otherwise`.
|
|
211
|
+
*/
|
|
212
|
+
Str.equivalentAlphanumeric = equivalentAlphanumericStrings;
|
|
213
|
+
})(Str || (exports.Str = Str = {}));
|
|
214
214
|
/** for simple regular expressions...
|
|
215
215
|
* so like not ones that have parentheses, pipes, or curly braced numbers */
|
|
216
216
|
function extractSource(regex) {
|