@alextheman/utility 1.4.1 → 1.5.1
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/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +15 -0
- package/dist/index.mjs +14 -0
- package/package.json +17 -12
package/dist/index.d.mts
CHANGED
|
@@ -10,4 +10,6 @@ declare function addDaysToDate(currentDate?: Date, dayIncrement?: number): Date;
|
|
|
10
10
|
|
|
11
11
|
declare function truncate(stringToTruncate: string, maxLength?: number): string;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
declare function appendSemicolon(stringToAppendTo: string): string;
|
|
14
|
+
|
|
15
|
+
export { addDaysToDate, appendSemicolon, formatDateAndTime, getRandomNumber, randomiseArray, truncate, wait };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,6 @@ declare function addDaysToDate(currentDate?: Date, dayIncrement?: number): Date;
|
|
|
10
10
|
|
|
11
11
|
declare function truncate(stringToTruncate: string, maxLength?: number): string;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
declare function appendSemicolon(stringToAppendTo: string): string;
|
|
14
|
+
|
|
15
|
+
export { addDaysToDate, appendSemicolon, formatDateAndTime, getRandomNumber, randomiseArray, truncate, wait };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
addDaysToDate: () => add_days_to_date_default,
|
|
24
|
+
appendSemicolon: () => append_semicolon_default,
|
|
24
25
|
formatDateAndTime: () => format_date_and_time_default,
|
|
25
26
|
getRandomNumber: () => get_random_number_default,
|
|
26
27
|
randomiseArray: () => randomise_array_default,
|
|
@@ -88,9 +89,23 @@ function truncate(stringToTruncate, maxLength = 5) {
|
|
|
88
89
|
return stringToTruncate.length > maxLength ? `${stringToTruncate.slice(0, maxLength)}...` : stringToTruncate;
|
|
89
90
|
}
|
|
90
91
|
var truncate_default = truncate;
|
|
92
|
+
|
|
93
|
+
// src/append-semicolon.ts
|
|
94
|
+
function appendSemicolon(stringToAppendTo) {
|
|
95
|
+
if (stringToAppendTo.includes("\n")) {
|
|
96
|
+
throw new Error("MULTIPLE_LINE_ERROR");
|
|
97
|
+
}
|
|
98
|
+
const stringWithNoTrailingWhitespace = stringToAppendTo.trimEnd();
|
|
99
|
+
if (stringWithNoTrailingWhitespace === "") {
|
|
100
|
+
return "";
|
|
101
|
+
}
|
|
102
|
+
return stringWithNoTrailingWhitespace[stringWithNoTrailingWhitespace.length - 1] === ";" ? stringWithNoTrailingWhitespace : `${stringWithNoTrailingWhitespace};`;
|
|
103
|
+
}
|
|
104
|
+
var append_semicolon_default = appendSemicolon;
|
|
91
105
|
// Annotate the CommonJS export names for ESM import in node:
|
|
92
106
|
0 && (module.exports = {
|
|
93
107
|
addDaysToDate,
|
|
108
|
+
appendSemicolon,
|
|
94
109
|
formatDateAndTime,
|
|
95
110
|
getRandomNumber,
|
|
96
111
|
randomiseArray,
|
package/dist/index.mjs
CHANGED
|
@@ -57,8 +57,22 @@ function truncate(stringToTruncate, maxLength = 5) {
|
|
|
57
57
|
return stringToTruncate.length > maxLength ? `${stringToTruncate.slice(0, maxLength)}...` : stringToTruncate;
|
|
58
58
|
}
|
|
59
59
|
var truncate_default = truncate;
|
|
60
|
+
|
|
61
|
+
// src/append-semicolon.ts
|
|
62
|
+
function appendSemicolon(stringToAppendTo) {
|
|
63
|
+
if (stringToAppendTo.includes("\n")) {
|
|
64
|
+
throw new Error("MULTIPLE_LINE_ERROR");
|
|
65
|
+
}
|
|
66
|
+
const stringWithNoTrailingWhitespace = stringToAppendTo.trimEnd();
|
|
67
|
+
if (stringWithNoTrailingWhitespace === "") {
|
|
68
|
+
return "";
|
|
69
|
+
}
|
|
70
|
+
return stringWithNoTrailingWhitespace[stringWithNoTrailingWhitespace.length - 1] === ";" ? stringWithNoTrailingWhitespace : `${stringWithNoTrailingWhitespace};`;
|
|
71
|
+
}
|
|
72
|
+
var append_semicolon_default = appendSemicolon;
|
|
60
73
|
export {
|
|
61
74
|
add_days_to_date_default as addDaysToDate,
|
|
75
|
+
append_semicolon_default as appendSemicolon,
|
|
62
76
|
format_date_and_time_default as formatDateAndTime,
|
|
63
77
|
get_random_number_default as getRandomNumber,
|
|
64
78
|
randomise_array_default as randomiseArray,
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/utility",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
8
10
|
"scripts": {
|
|
9
11
|
"test": "TZ=UTC jest",
|
|
10
|
-
"format": "
|
|
11
|
-
"lint": "
|
|
12
|
+
"format": "prettier --write --parser typescript 'src/**/*.ts' '__tests__/**/*.test.ts' && ESLINT_MODE=fix eslint --fix 'src/**/*.ts' '__tests__/**/*.ts'",
|
|
13
|
+
"lint": "ESLINT_MODE=lint eslint 'src/**/*.ts' '__tests__/**/*.ts' && prettier --check --parser typescript 'src/**/*.ts' '__tests__/**/*.ts'",
|
|
12
14
|
"prepare": "husky",
|
|
13
15
|
"build": "tsup"
|
|
14
16
|
},
|
|
@@ -17,16 +19,19 @@
|
|
|
17
19
|
"license": "ISC",
|
|
18
20
|
"description": "",
|
|
19
21
|
"devDependencies": {
|
|
20
|
-
"@eslint
|
|
21
|
-
"@
|
|
22
|
-
"
|
|
23
|
-
"
|
|
22
|
+
"@alextheman/eslint-config-typescript-base": "^1.0.5",
|
|
23
|
+
"@eslint/js": "^9.31.0",
|
|
24
|
+
"@types/jest": "^30.0.0",
|
|
25
|
+
"eslint": "^9.31.0",
|
|
26
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
27
|
+
"eslint-plugin-import": "^2.32.0",
|
|
28
|
+
"globals": "^16.3.0",
|
|
24
29
|
"husky": "^9.1.7",
|
|
25
|
-
"jest": "^
|
|
26
|
-
"prettier": "^3.
|
|
27
|
-
"ts-jest": "^29.
|
|
30
|
+
"jest": "^30.0.4",
|
|
31
|
+
"prettier": "^3.6.2",
|
|
32
|
+
"ts-jest": "^29.4.0",
|
|
28
33
|
"tsup": "^8.5.0",
|
|
29
34
|
"typescript": "^5.8.3",
|
|
30
|
-
"typescript-eslint": "^8.
|
|
35
|
+
"typescript-eslint": "^8.36.0"
|
|
31
36
|
}
|
|
32
37
|
}
|