@alextheman/utility 1.5.2 → 1.7.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/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +26 -0
- package/dist/index.mjs +25 -0
- package/package.json +18 -10
package/dist/index.d.mts
CHANGED
|
@@ -12,4 +12,6 @@ declare function truncate(stringToTruncate: string, maxLength?: number): string;
|
|
|
12
12
|
|
|
13
13
|
declare function appendSemicolon(stringToAppendTo: string): string;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
declare function range(start: number, stop: number, step?: number): number[];
|
|
16
|
+
|
|
17
|
+
export { addDaysToDate, appendSemicolon, formatDateAndTime, getRandomNumber, randomiseArray, range, truncate, wait };
|
package/dist/index.d.ts
CHANGED
|
@@ -12,4 +12,6 @@ declare function truncate(stringToTruncate: string, maxLength?: number): string;
|
|
|
12
12
|
|
|
13
13
|
declare function appendSemicolon(stringToAppendTo: string): string;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
declare function range(start: number, stop: number, step?: number): number[];
|
|
16
|
+
|
|
17
|
+
export { addDaysToDate, appendSemicolon, formatDateAndTime, getRandomNumber, randomiseArray, range, truncate, wait };
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __export(index_exports, {
|
|
|
25
25
|
formatDateAndTime: () => format_date_and_time_default,
|
|
26
26
|
getRandomNumber: () => get_random_number_default,
|
|
27
27
|
randomiseArray: () => randomise_array_default,
|
|
28
|
+
range: () => range_default,
|
|
28
29
|
truncate: () => truncate_default,
|
|
29
30
|
wait: () => wait_default
|
|
30
31
|
});
|
|
@@ -102,6 +103,30 @@ function appendSemicolon(stringToAppendTo) {
|
|
|
102
103
|
return stringWithNoTrailingWhitespace[stringWithNoTrailingWhitespace.length - 1] === ";" ? stringWithNoTrailingWhitespace : `${stringWithNoTrailingWhitespace};`;
|
|
103
104
|
}
|
|
104
105
|
var append_semicolon_default = appendSemicolon;
|
|
106
|
+
|
|
107
|
+
// src/range.ts
|
|
108
|
+
function range(start, stop, step = 1) {
|
|
109
|
+
const numbers = [];
|
|
110
|
+
if (step === 0) {
|
|
111
|
+
throw new Error("ZERO_STEP_SIZE_NOT_ALLOWED");
|
|
112
|
+
} else if (step > 0) {
|
|
113
|
+
if (start > stop) {
|
|
114
|
+
throw new Error("INVALID_BOUNDARIES");
|
|
115
|
+
}
|
|
116
|
+
for (let i = start; i < stop; i += step) {
|
|
117
|
+
numbers.push(i);
|
|
118
|
+
}
|
|
119
|
+
} else if (step < 0) {
|
|
120
|
+
if (start < stop) {
|
|
121
|
+
throw new Error("INVALID_BOUNDARIES");
|
|
122
|
+
}
|
|
123
|
+
for (let i = start; i > stop; i += step) {
|
|
124
|
+
numbers.push(i);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return numbers;
|
|
128
|
+
}
|
|
129
|
+
var range_default = range;
|
|
105
130
|
// Annotate the CommonJS export names for ESM import in node:
|
|
106
131
|
0 && (module.exports = {
|
|
107
132
|
addDaysToDate,
|
|
@@ -109,6 +134,7 @@ var append_semicolon_default = appendSemicolon;
|
|
|
109
134
|
formatDateAndTime,
|
|
110
135
|
getRandomNumber,
|
|
111
136
|
randomiseArray,
|
|
137
|
+
range,
|
|
112
138
|
truncate,
|
|
113
139
|
wait
|
|
114
140
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -70,12 +70,37 @@ function appendSemicolon(stringToAppendTo) {
|
|
|
70
70
|
return stringWithNoTrailingWhitespace[stringWithNoTrailingWhitespace.length - 1] === ";" ? stringWithNoTrailingWhitespace : `${stringWithNoTrailingWhitespace};`;
|
|
71
71
|
}
|
|
72
72
|
var append_semicolon_default = appendSemicolon;
|
|
73
|
+
|
|
74
|
+
// src/range.ts
|
|
75
|
+
function range(start, stop, step = 1) {
|
|
76
|
+
const numbers = [];
|
|
77
|
+
if (step === 0) {
|
|
78
|
+
throw new Error("ZERO_STEP_SIZE_NOT_ALLOWED");
|
|
79
|
+
} else if (step > 0) {
|
|
80
|
+
if (start > stop) {
|
|
81
|
+
throw new Error("INVALID_BOUNDARIES");
|
|
82
|
+
}
|
|
83
|
+
for (let i = start; i < stop; i += step) {
|
|
84
|
+
numbers.push(i);
|
|
85
|
+
}
|
|
86
|
+
} else if (step < 0) {
|
|
87
|
+
if (start < stop) {
|
|
88
|
+
throw new Error("INVALID_BOUNDARIES");
|
|
89
|
+
}
|
|
90
|
+
for (let i = start; i > stop; i += step) {
|
|
91
|
+
numbers.push(i);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return numbers;
|
|
95
|
+
}
|
|
96
|
+
var range_default = range;
|
|
73
97
|
export {
|
|
74
98
|
add_days_to_date_default as addDaysToDate,
|
|
75
99
|
append_semicolon_default as appendSemicolon,
|
|
76
100
|
format_date_and_time_default as formatDateAndTime,
|
|
77
101
|
get_random_number_default as getRandomNumber,
|
|
78
102
|
randomise_array_default as randomiseArray,
|
|
103
|
+
range_default as range,
|
|
79
104
|
truncate_default as truncate,
|
|
80
105
|
wait_default as wait
|
|
81
106
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alextheman/utility",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,30 +8,38 @@
|
|
|
8
8
|
"dist"
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
|
-
"test": "TZ=UTC
|
|
12
|
-
"
|
|
13
|
-
"
|
|
11
|
+
"test": "TZ=UTC vitest run",
|
|
12
|
+
"test-watch": "TZ=UTC vitest",
|
|
13
|
+
"format": "prettier --write --parser typescript 'src/**/*.ts' 'tests/**/*.test.ts' && ESLINT_MODE=fix eslint --fix 'src/**/*.ts' 'tests/**/*.ts'",
|
|
14
|
+
"lint": "ESLINT_MODE=lint eslint 'src/**/*.ts' 'tests/**/*.ts' && prettier --check --parser typescript 'src/**/*.ts' 'tests/**/*.ts'",
|
|
14
15
|
"prepare": "husky",
|
|
15
|
-
"build": "tsup"
|
|
16
|
+
"build": "tsup",
|
|
17
|
+
"update-dependencies": "npx npm-check-updates -u && npm install",
|
|
18
|
+
"change-major": "npm version major -m \"Change version number to v%s\"",
|
|
19
|
+
"change-minor": "npm version minor -m \"Change version number to v%s\"",
|
|
20
|
+
"change-patch": "npm version patch -m \"Change version number to v%s\""
|
|
16
21
|
},
|
|
17
22
|
"keywords": [],
|
|
18
23
|
"author": "",
|
|
19
24
|
"license": "ISC",
|
|
20
25
|
"description": "",
|
|
21
26
|
"devDependencies": {
|
|
22
|
-
"@alextheman/eslint-config-typescript-base": "^1.0.5",
|
|
23
27
|
"@eslint/js": "^9.31.0",
|
|
24
|
-
"@types/
|
|
28
|
+
"@types/node": "^24.0.15",
|
|
25
29
|
"eslint": "^9.31.0",
|
|
26
30
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
27
31
|
"eslint-plugin-import": "^2.32.0",
|
|
28
32
|
"globals": "^16.3.0",
|
|
29
33
|
"husky": "^9.1.7",
|
|
30
|
-
"
|
|
34
|
+
"jsdom": "^26.1.0",
|
|
31
35
|
"prettier": "^3.6.2",
|
|
32
|
-
"ts-jest": "^29.4.0",
|
|
33
36
|
"tsup": "^8.5.0",
|
|
34
37
|
"typescript": "^5.8.3",
|
|
35
|
-
"typescript-eslint": "^8.
|
|
38
|
+
"typescript-eslint": "^8.37.0",
|
|
39
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
40
|
+
"vitest": "^3.2.4"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@alextheman/eslint-config-typescript-base": "^1.0.12"
|
|
36
44
|
}
|
|
37
45
|
}
|