turf-common 1.1.1-beta.57 → 1.1.1-beta.59
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/build/@utils.d.ts +1 -0
- package/build/@utils.js +1 -0
- package/build/utils/string-utils.d.ts +19 -0
- package/build/utils/string-utils.js +29 -0
- package/package.json +1 -1
package/build/@utils.d.ts
CHANGED
package/build/@utils.js
CHANGED
|
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./interface/api/utils"), exports);
|
|
18
|
+
__exportStar(require("./utils/format-string-with-hyphens"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare class StringUtil {
|
|
2
|
+
/**
|
|
3
|
+
* Tests if a string matches any regular expression in an array.
|
|
4
|
+
*
|
|
5
|
+
* @param {RegExp[]} regexArray - The array of regular expressions to test against.
|
|
6
|
+
* @param {string} testString - The string to test.
|
|
7
|
+
* @returns {boolean} Returns true if testString matches any regular expression in regexArray, false otherwise.
|
|
8
|
+
*/
|
|
9
|
+
testRegexArray(regexArray: RegExp[], testString: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Formats a string by converting it to lowercase and replacing spaces with hyphens.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} inputString - The input string to be formatted.
|
|
14
|
+
* @returns {string} - The formatted string with hyphens.
|
|
15
|
+
*/
|
|
16
|
+
FormatStringWithHyphens(inputString: string): string;
|
|
17
|
+
}
|
|
18
|
+
export declare const stringUtil: StringUtil;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stringUtil = void 0;
|
|
4
|
+
var StringUtil = /** @class */ (function () {
|
|
5
|
+
function StringUtil() {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Tests if a string matches any regular expression in an array.
|
|
9
|
+
*
|
|
10
|
+
* @param {RegExp[]} regexArray - The array of regular expressions to test against.
|
|
11
|
+
* @param {string} testString - The string to test.
|
|
12
|
+
* @returns {boolean} Returns true if testString matches any regular expression in regexArray, false otherwise.
|
|
13
|
+
*/
|
|
14
|
+
StringUtil.prototype.testRegexArray = function (regexArray, testString) {
|
|
15
|
+
return regexArray.some(function (regex) { return regex.test(testString); });
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Formats a string by converting it to lowercase and replacing spaces with hyphens.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} inputString - The input string to be formatted.
|
|
21
|
+
* @returns {string} - The formatted string with hyphens.
|
|
22
|
+
*/
|
|
23
|
+
StringUtil.prototype.FormatStringWithHyphens = function (inputString) {
|
|
24
|
+
// Convert the input string to lowercase and replace spaces with hyphens
|
|
25
|
+
return inputString.toLowerCase().replace(/\s+/g, "-");
|
|
26
|
+
};
|
|
27
|
+
return StringUtil;
|
|
28
|
+
}());
|
|
29
|
+
exports.stringUtil = new StringUtil();
|