@matterbridge/utils 3.9.0-dev-20260613-d7e6c0b → 3.9.1-dev-20260614-89d7aeb

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,9 +1,9 @@
1
1
  import { isValidNumber } from './validate.js';
2
2
  export function hasParameter(name) {
3
- const commandArguments = process.argv.slice(2);
4
- let markerIncluded = commandArguments.includes(`-${name}`);
3
+ const commandArguments = new Set(process.argv.slice(2));
4
+ let markerIncluded = commandArguments.has(`-${name}`);
5
5
  if (!markerIncluded)
6
- markerIncluded = commandArguments.includes(`--${name}`);
6
+ markerIncluded = commandArguments.has(`--${name}`);
7
7
  return markerIncluded;
8
8
  }
9
9
  export function hasAnyParameter(...params) {
@@ -24,7 +24,7 @@ export function getIntParameter(name) {
24
24
  const value = getParameter(name);
25
25
  if (value === undefined)
26
26
  return undefined;
27
- const intValue = parseInt(value, 10);
27
+ const intValue = Number.parseInt(value, 10);
28
28
  if (!isValidNumber(intValue))
29
29
  return undefined;
30
30
  return intValue;
@@ -38,7 +38,7 @@ export function getIntArrayParameter(name) {
38
38
  return undefined;
39
39
  const intValues = [];
40
40
  for (let i = markerIndex + 1; i < commandArguments.length && !commandArguments[i].startsWith('-'); i++) {
41
- const intValue = parseInt(commandArguments[i], 10);
41
+ const intValue = Number.parseInt(commandArguments[i], 10);
42
42
  if (isValidNumber(intValue))
43
43
  intValues.push(intValue);
44
44
  }
@@ -1,2 +1,2 @@
1
- import { AnsiLogger } from 'node-ansi-logger';
1
+ import { type AnsiLogger } from 'node-ansi-logger';
2
2
  export declare function copyDirectory(srcDir: string, destDir: string, log?: AnsiLogger): Promise<boolean>;
@@ -1,2 +1,2 @@
1
- import { AnsiLogger } from 'node-ansi-logger';
1
+ import { type AnsiLogger } from 'node-ansi-logger';
2
2
  export declare function createDirectory(path: string, name: string, log: AnsiLogger): Promise<void>;
package/dist/format.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export function formatTimeStamp(timestamp) {
2
- return `${new Date(timestamp).toLocaleString()}`;
2
+ return new Date(timestamp).toLocaleString();
3
3
  }
4
4
  export function formatPercent(percent, digits = 2) {
5
5
  return `${percent.toFixed(digits)} %`;
package/dist/hex.js CHANGED
@@ -23,7 +23,7 @@ export function hexToBuffer(hex) {
23
23
  const length = cleaned.length / 2;
24
24
  const result = new Uint8Array(length);
25
25
  for (let i = 0; i < length; i++) {
26
- result[i] = parseInt(cleaned.slice(i * 2, i * 2 + 2), 16);
26
+ result[i] = Number.parseInt(cleaned.slice(i * 2, i * 2 + 2), 16);
27
27
  }
28
28
  return result;
29
29
  }
package/dist/validate.js CHANGED
@@ -62,9 +62,9 @@ export function parseVersionString(versionString) {
62
62
  if (!match)
63
63
  return undefined;
64
64
  const [, majorStr, minorStr, patchStr] = match;
65
- const major = parseInt(majorStr, 10);
66
- const minor = parseInt(minorStr, 10);
67
- const patch = parseInt(patchStr, 10);
65
+ const major = Number.parseInt(majorStr, 10);
66
+ const minor = Number.parseInt(minorStr, 10);
67
+ const patch = Number.parseInt(patchStr, 10);
68
68
  if ([major, minor, patch].some((n) => !Number.isFinite(n)) || major > 99 || minor > 99 || patch > 99) {
69
69
  return undefined;
70
70
  }
package/dist/wait.js CHANGED
@@ -32,7 +32,7 @@ export async function waiter(name, check, exitWithReject = false, resolveTimeout
32
32
  }, resolveInterval).unref();
33
33
  });
34
34
  }
35
- export function wait(timeout = 1000, name, debug = false) {
35
+ export async function wait(timeout = 1000, name, debug = false) {
36
36
  const log = new AnsiLogger({ logName: 'Wait', logTimestampFormat: 4, logLevel: "debug" });
37
37
  if (debug)
38
38
  log.debug(`Wait "${name}" started...`);
@@ -44,7 +44,7 @@ export function wait(timeout = 1000, name, debug = false) {
44
44
  }, timeout).unref();
45
45
  });
46
46
  }
47
- export function withTimeout(promise, timeoutMillisecs = 10000, reThrow = true) {
47
+ export async function withTimeout(promise, timeoutMillisecs = 10000, reThrow = true) {
48
48
  return new Promise((resolve, reject) => {
49
49
  const timer = setTimeout(() => {
50
50
  if (reThrow) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matterbridge/utils",
3
- "version": "3.9.0-dev-20260613-d7e6c0b",
3
+ "version": "3.9.1-dev-20260614-89d7aeb",
4
4
  "description": "Matterbridge utils library",
5
5
  "author": "https://github.com/Luligu",
6
6
  "homepage": "https://matterbridge.io/",