@alextheman/utility 2.2.0 → 2.3.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.cjs CHANGED
@@ -65,6 +65,7 @@ __export(index_exports, {
65
65
  parseUUID: () => UUID_default,
66
66
  randomiseArray: () => randomiseArray_default,
67
67
  range: () => range_default,
68
+ removeDuplicates: () => removeDuplicates_default,
68
69
  stringToBoolean: () => stringToBoolean_default,
69
70
  truncate: () => truncate_default,
70
71
  wait: () => wait_default
@@ -282,6 +283,18 @@ function range(start, stop, step = 1) {
282
283
  }
283
284
  var range_default = range;
284
285
 
286
+ // src/functions/removeDuplicates.ts
287
+ function removeDuplicates(array) {
288
+ const outputArray = [];
289
+ for (const item of array) {
290
+ if (!outputArray.includes(item)) {
291
+ outputArray.push(item);
292
+ }
293
+ }
294
+ return outputArray;
295
+ }
296
+ var removeDuplicates_default = removeDuplicates;
297
+
285
298
  // src/functions/stringToBoolean.ts
286
299
  function stringToBoolean(inputString) {
287
300
  const normalisedString = inputString.toLowerCase();
@@ -398,6 +411,7 @@ var UUID_default = parseUUID;
398
411
  parseUUID,
399
412
  randomiseArray,
400
413
  range,
414
+ removeDuplicates,
401
415
  stringToBoolean,
402
416
  truncate,
403
417
  wait
package/dist/index.d.cts CHANGED
@@ -28,6 +28,8 @@ declare function randomiseArray<T>(array: T[]): T[];
28
28
 
29
29
  declare function range(start: number, stop: number, step?: number): number[];
30
30
 
31
+ declare function removeDuplicates<T>(array: T[]): T[];
32
+
31
33
  declare function stringToBoolean(inputString: string): boolean;
32
34
 
33
35
  declare function truncate(stringToTruncate: string, maxLength?: number): string;
@@ -64,4 +66,4 @@ type DisallowUndefined<T> = undefined extends T ? ["Error: Generic type cannot i
64
66
 
65
67
  type NonUndefined<T> = T extends undefined ? never : T;
66
68
 
67
- export { APIError, type DisallowUndefined, type Email, type Env, type HTTPErrorCodes, type NonUndefined, type UUID, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, fillArray, formatDateAndTime, getRandomNumber, httpErrorCodeLookup, interpolateObjects, isLeapYear, isMonthlyMultiple, isSameDate, omitProperties, parseEmail, parseEnv, parseIntStrict, parseUUID, randomiseArray, range, stringToBoolean, truncate, wait };
69
+ export { APIError, type DisallowUndefined, type Email, type Env, type HTTPErrorCodes, type NonUndefined, type UUID, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, fillArray, formatDateAndTime, getRandomNumber, httpErrorCodeLookup, interpolateObjects, isLeapYear, isMonthlyMultiple, isSameDate, omitProperties, parseEmail, parseEnv, parseIntStrict, parseUUID, randomiseArray, range, removeDuplicates, stringToBoolean, truncate, wait };
package/dist/index.d.ts CHANGED
@@ -28,6 +28,8 @@ declare function randomiseArray<T>(array: T[]): T[];
28
28
 
29
29
  declare function range(start: number, stop: number, step?: number): number[];
30
30
 
31
+ declare function removeDuplicates<T>(array: T[]): T[];
32
+
31
33
  declare function stringToBoolean(inputString: string): boolean;
32
34
 
33
35
  declare function truncate(stringToTruncate: string, maxLength?: number): string;
@@ -64,4 +66,4 @@ type DisallowUndefined<T> = undefined extends T ? ["Error: Generic type cannot i
64
66
 
65
67
  type NonUndefined<T> = T extends undefined ? never : T;
66
68
 
67
- export { APIError, type DisallowUndefined, type Email, type Env, type HTTPErrorCodes, type NonUndefined, type UUID, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, fillArray, formatDateAndTime, getRandomNumber, httpErrorCodeLookup, interpolateObjects, isLeapYear, isMonthlyMultiple, isSameDate, omitProperties, parseEmail, parseEnv, parseIntStrict, parseUUID, randomiseArray, range, stringToBoolean, truncate, wait };
69
+ export { APIError, type DisallowUndefined, type Email, type Env, type HTTPErrorCodes, type NonUndefined, type UUID, addDaysToDate, appendSemicolon, camelToKebab, convertFileToBase64, fillArray, formatDateAndTime, getRandomNumber, httpErrorCodeLookup, interpolateObjects, isLeapYear, isMonthlyMultiple, isSameDate, omitProperties, parseEmail, parseEnv, parseIntStrict, parseUUID, randomiseArray, range, removeDuplicates, stringToBoolean, truncate, wait };
package/dist/index.js CHANGED
@@ -227,6 +227,18 @@ function range(start, stop, step = 1) {
227
227
  }
228
228
  var range_default = range;
229
229
 
230
+ // src/functions/removeDuplicates.ts
231
+ function removeDuplicates(array) {
232
+ const outputArray = [];
233
+ for (const item of array) {
234
+ if (!outputArray.includes(item)) {
235
+ outputArray.push(item);
236
+ }
237
+ }
238
+ return outputArray;
239
+ }
240
+ var removeDuplicates_default = removeDuplicates;
241
+
230
242
  // src/functions/stringToBoolean.ts
231
243
  function stringToBoolean(inputString) {
232
244
  const normalisedString = inputString.toLowerCase();
@@ -342,6 +354,7 @@ export {
342
354
  UUID_default as parseUUID,
343
355
  randomiseArray_default as randomiseArray,
344
356
  range_default as range,
357
+ removeDuplicates_default as removeDuplicates,
345
358
  stringToBoolean_default as stringToBoolean,
346
359
  truncate_default as truncate,
347
360
  wait_default as wait
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alextheman/utility",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Helpful utility functions",
5
5
  "license": "ISC",
6
6
  "author": "alextheman",
@@ -36,20 +36,20 @@
36
36
  "zod": "^4.1.12"
37
37
  },
38
38
  "devDependencies": {
39
- "@alextheman/eslint-plugin": "^1.14.2",
39
+ "@alextheman/eslint-plugin": "^2.2.1",
40
40
  "@eslint/js": "^9.38.0",
41
- "@types/node": "^24.8.1",
41
+ "@types/node": "^24.9.1",
42
42
  "eslint": "^9.38.0",
43
43
  "eslint-import-resolver-typescript": "^4.4.4",
44
44
  "eslint-plugin-import": "^2.32.0",
45
45
  "globals": "^16.4.0",
46
46
  "husky": "^9.1.7",
47
- "jsdom": "^27.0.0",
47
+ "jsdom": "^27.0.1",
48
48
  "prettier": "^3.6.2",
49
49
  "tsup": "^8.5.0",
50
50
  "typescript": "^5.9.3",
51
- "typescript-eslint": "^8.46.1",
51
+ "typescript-eslint": "^8.46.2",
52
52
  "vite-tsconfig-paths": "^5.1.4",
53
- "vitest": "^3.2.4"
53
+ "vitest": "^4.0.3"
54
54
  }
55
55
  }