@codedrifters/utils 0.0.28 → 0.0.29
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,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
*
|
|
3
|
-
* @param inString string to hash
|
|
4
|
-
* @param trimLength trim to this length (defaults to 999 chars)
|
|
5
|
-
* @returns
|
|
3
|
+
* @param inString - string to hash
|
|
4
|
+
* @param trimLength - trim to this length (defaults to 999 chars)
|
|
5
|
+
* @returns Hex-encoded sha256 digest, truncated to `trimLength` characters.
|
|
6
6
|
*/
|
|
7
7
|
export declare const hashString: (inString: string, trimLength?: number) => string;
|
|
8
8
|
/**
|
|
9
9
|
*
|
|
10
|
-
* @param inputString string to truncate
|
|
11
|
-
* @param maxLength max length of this string
|
|
10
|
+
* @param inputString - string to truncate
|
|
11
|
+
* @param maxLength - max length of this string
|
|
12
12
|
* @returns trimmed string
|
|
13
13
|
*/
|
|
14
14
|
export declare const trimStringLength: (inputString: string, maxLength: number) => string;
|
|
@@ -37,9 +37,9 @@ exports.trimStringLength = exports.hashString = void 0;
|
|
|
37
37
|
const crypto = __importStar(require("node:crypto"));
|
|
38
38
|
/**
|
|
39
39
|
*
|
|
40
|
-
* @param inString string to hash
|
|
41
|
-
* @param trimLength trim to this length (defaults to 999 chars)
|
|
42
|
-
* @returns
|
|
40
|
+
* @param inString - string to hash
|
|
41
|
+
* @param trimLength - trim to this length (defaults to 999 chars)
|
|
42
|
+
* @returns Hex-encoded sha256 digest, truncated to `trimLength` characters.
|
|
43
43
|
*/
|
|
44
44
|
const hashString = (inString, trimLength = 999) => {
|
|
45
45
|
return crypto
|
|
@@ -51,8 +51,8 @@ const hashString = (inString, trimLength = 999) => {
|
|
|
51
51
|
exports.hashString = hashString;
|
|
52
52
|
/**
|
|
53
53
|
*
|
|
54
|
-
* @param inputString string to truncate
|
|
55
|
-
* @param maxLength max length of this string
|
|
54
|
+
* @param inputString - string to truncate
|
|
55
|
+
* @param maxLength - max length of this string
|
|
56
56
|
* @returns trimmed string
|
|
57
57
|
*/
|
|
58
58
|
const trimStringLength = (inputString, maxLength) => {
|
|
@@ -61,4 +61,4 @@ const trimStringLength = (inputString, maxLength) => {
|
|
|
61
61
|
: inputString.substring(0, maxLength);
|
|
62
62
|
};
|
|
63
63
|
exports.trimStringLength = trimStringLength;
|
|
64
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
64
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyaW5nLXV0aWxzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3N0cmluZy9zdHJpbmctdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsb0RBQXNDO0FBRXRDOzs7OztHQUtHO0FBQ0ksTUFBTSxVQUFVLEdBQUcsQ0FBQyxRQUFnQixFQUFFLGFBQXFCLEdBQUcsRUFBRSxFQUFFO0lBQ3ZFLE9BQU8sTUFBTTtTQUNWLFVBQVUsQ0FBQyxRQUFRLENBQUM7U0FDcEIsTUFBTSxDQUFDLFFBQVEsQ0FBQztTQUNoQixNQUFNLENBQUMsS0FBSyxDQUFDO1NBQ2IsU0FBUyxDQUFDLENBQUMsRUFBRSxVQUFVLENBQUMsQ0FBQztBQUM5QixDQUFDLENBQUM7QUFOVyxRQUFBLFVBQVUsY0FNckI7QUFFRjs7Ozs7R0FLRztBQUNJLE1BQU0sZ0JBQWdCLEdBQUcsQ0FBQyxXQUFtQixFQUFFLFNBQWlCLEVBQUUsRUFBRTtJQUN6RSxPQUFPLFdBQVcsQ0FBQyxNQUFNLEdBQUcsU0FBUztRQUNuQyxDQUFDLENBQUMsV0FBVztRQUNiLENBQUMsQ0FBQyxXQUFXLENBQUMsU0FBUyxDQUFDLENBQU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