@luxass/utils 2.7.3 → 2.7.5

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/guards.mjs CHANGED
@@ -63,6 +63,5 @@ function isNotUndefined(v) {
63
63
  function isTruthy(v) {
64
64
  return Boolean(v);
65
65
  }
66
-
67
66
  //#endregion
68
- export { isNotNull, isNotNullish, isNotUndefined, isTruthy };
67
+ export { isNotNull, isNotNullish, isNotUndefined, isTruthy };
package/dist/index.mjs CHANGED
@@ -4,9 +4,9 @@ import { clamp } from "./number.mjs";
4
4
  import { getChangedKeys, getOwnProperty, hasOwnProperty, omit } from "./object.mjs";
5
5
  import { appendTrailingSlash, prependLeadingSlash, trimLeadingSlash, trimTrailingSlash } from "./path.mjs";
6
6
  import pRetry from "p-retry";
7
-
8
7
  //#region src/common.ts
9
8
  var InvariantError = class extends Error {
9
+ message;
10
10
  constructor(message, ...positionals) {
11
11
  super(message);
12
12
  this.message = message;
@@ -25,6 +25,5 @@ var InvariantError = class extends Error {
25
25
  function invariant(predicate, message, ...positionals) {
26
26
  if (!predicate) throw new InvariantError(message, ...positionals);
27
27
  }
28
-
29
28
  //#endregion
30
- export { InvariantError, appendTrailingSlash, capitalize, clamp, dedent, dedentRaw, formatStr, getChangedKeys, getOwnProperty, hasOwnProperty, invariant, isNotNull, isNotNullish, isNotUndefined, isTruthy, omit, prependLeadingSlash, pRetry as promiseRetry, sanitizeIdentifier, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, trimLeadingSlash, trimTrailingSlash };
29
+ export { InvariantError, appendTrailingSlash, capitalize, clamp, dedent, dedentRaw, formatStr, getChangedKeys, getOwnProperty, hasOwnProperty, invariant, isNotNull, isNotNullish, isNotUndefined, isTruthy, omit, prependLeadingSlash, pRetry as promiseRetry, sanitizeIdentifier, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, trimLeadingSlash, trimTrailingSlash };
package/dist/number.mjs CHANGED
@@ -21,6 +21,5 @@
21
21
  function clamp(value, min, max) {
22
22
  return Math.min(Math.max(value, min), max);
23
23
  }
24
-
25
24
  //#endregion
26
- export { clamp };
25
+ export { clamp };
package/dist/object.mjs CHANGED
@@ -70,6 +70,5 @@ function omit(obj, keys) {
70
70
  for (const key of keys) delete result[key];
71
71
  return result;
72
72
  }
73
-
74
73
  //#endregion
75
- export { getChangedKeys, getOwnProperty, hasOwnProperty, omit };
74
+ export { getChangedKeys, getOwnProperty, hasOwnProperty, omit };
package/dist/path.d.mts CHANGED
@@ -61,40 +61,6 @@ declare function appendTrailingSlash(path: string | undefined): string;
61
61
  * ```
62
62
  */
63
63
  declare function prependLeadingSlash(path: string | undefined): string;
64
- /**
65
- * Joins URL paths together, handling trailing and leading slashes appropriately
66
- * @param {string} base - The base URL path
67
- * @param {...string} segments - Additional URL segments to join
68
- * @returns {string} The joined URL path
69
- *
70
- * @example
71
- * ```ts
72
- * import { joinURL } from "@luxass/utils/path";
73
- *
74
- * // Basic path joining
75
- * joinURL("api", "users") // "api/users"
76
- * joinURL("api/", "users") // "api/users"
77
- * joinURL("api", "/users") // "api/users"
78
- * joinURL("api/", "/users") // "api/users"
79
- *
80
- * // URL joining with protocol
81
- * joinURL("https://api.example.com", "v1/users") // "https://api.example.com/v1/users"
82
- * joinURL("https://api.example.com/", "/v1/users") // "https://api.example.com/v1/users"
83
- *
84
- * // Multiple slash normalization
85
- * joinURL("api//v1/", "//users///") // "api/v1/users/"
86
- * joinURL("base///", "///path") // "base/path"
87
- *
88
- * // Root path handling
89
- * joinURL("/", "users") // "/users"
90
- * joinURL("api", "/") // "api/"
91
- *
92
- * // Empty and undefined handling
93
- * joinURL("", "users") // "users"
94
- * joinURL("api", "") // "api"
95
- * joinURL("", "") // "/"
96
- * ```
97
- */
98
64
  declare function joinURL(base: string, ...segments: string[]): string;
99
65
  //#endregion
100
66
  export { appendTrailingSlash, joinURL, prependLeadingSlash, trimLeadingSlash, trimTrailingSlash };
package/dist/path.mjs CHANGED
@@ -107,12 +107,12 @@ function prependLeadingSlash(path) {
107
107
  * joinURL("", "") // "/"
108
108
  * ```
109
109
  */
110
+ function normalizeURLPath(path) {
111
+ return path.replace(/([^:])\/+/g, "$1/").replace(/^\/+/, "/");
112
+ }
110
113
  function joinURL(base, ...segments) {
111
114
  if (!base && !segments) return "/";
112
115
  if (!segments || segments.length === 0) return base || "/";
113
- const normalize = (s) => {
114
- return s.replace(/([^:])\/+/g, "$1/").replace(/^\/+/, "/");
115
- };
116
116
  let path = base;
117
117
  for (const seg of segments) {
118
118
  if (!seg || seg === ".") continue;
@@ -123,8 +123,7 @@ function joinURL(base, ...segments) {
123
123
  else path += pathTrailing || segLeading ? seg : `/${seg}`;
124
124
  } else path += seg;
125
125
  }
126
- return normalize(path) || "/";
126
+ return normalizeURLPath(path) || "/";
127
127
  }
128
-
129
128
  //#endregion
130
- export { appendTrailingSlash, joinURL, prependLeadingSlash, trimLeadingSlash, trimTrailingSlash };
129
+ export { appendTrailingSlash, joinURL, prependLeadingSlash, trimLeadingSlash, trimTrailingSlash };
package/dist/string.mjs CHANGED
@@ -144,10 +144,10 @@ function dedentRaw(strings, ...values) {
144
144
  }
145
145
  /** @internal */
146
146
  function internal_dedent(strings, values, raw = false) {
147
- const _raw = typeof strings === "string" ? [strings] : raw ? strings.raw : strings;
147
+ const rawStrings = typeof strings === "string" ? [strings] : raw ? strings.raw : strings;
148
148
  let result = "";
149
- for (let i = 0; i < _raw.length; i++) {
150
- const next = _raw[i];
149
+ for (let i = 0; i < rawStrings.length; i++) {
150
+ const next = rawStrings[i];
151
151
  result += next;
152
152
  if (i < values.length) result += values[i];
153
153
  }
@@ -190,6 +190,7 @@ function serializePositional(positional, flag) {
190
190
  if (json === "{}" || json === "[]" || /^\[object .+?\]$/.test(json)) return positional;
191
191
  return json;
192
192
  }
193
+ return positional;
193
194
  }
194
195
  /**
195
196
  * Formats a string by replacing placeholders with positional values
@@ -223,6 +224,5 @@ function formatStr(message, ...positionals) {
223
224
  formattedMessage = formattedMessage.replace(/%{2}/g, "%");
224
225
  return formattedMessage;
225
226
  }
226
-
227
227
  //#endregion
228
- export { capitalize, dedent, dedentRaw, formatStr, sanitizeIdentifier, toCamelCase, toKebabCase, toPascalCase, toSnakeCase };
228
+ export { capitalize, dedent, dedentRaw, formatStr, sanitizeIdentifier, toCamelCase, toKebabCase, toPascalCase, toSnakeCase };
package/dist/types.mjs CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {};
package/package.json CHANGED
@@ -1,27 +1,30 @@
1
1
  {
2
2
  "name": "@luxass/utils",
3
- "version": "2.7.3",
3
+ "version": "2.7.5",
4
4
  "description": "A collection of utilities for JavaScript/TypeScript",
5
- "type": "module",
5
+ "keywords": [
6
+ "utils"
7
+ ],
8
+ "homepage": "https://github.com/luxass/utils",
9
+ "bugs": {
10
+ "url": "https://github.com/luxass/utils/issues"
11
+ },
12
+ "license": "MIT",
6
13
  "author": {
7
14
  "name": "Lucas Nørgård",
8
15
  "email": "lucasnrgaard@gmail.com",
9
16
  "url": "https://luxass.dev"
10
17
  },
11
- "packageManager": "pnpm@10.28.2",
12
- "license": "MIT",
13
- "homepage": "https://github.com/luxass/utils",
14
18
  "repository": {
15
19
  "type": "git",
16
20
  "url": "git+https://github.com/luxass/utils.git"
17
21
  },
18
- "bugs": {
19
- "url": "https://github.com/luxass/utils/issues"
20
- },
21
- "keywords": [
22
- "utils"
22
+ "files": [
23
+ "dist"
23
24
  ],
25
+ "type": "module",
24
26
  "sideEffects": false,
27
+ "types": "./dist/index.d.mts",
25
28
  "exports": {
26
29
  ".": "./dist/index.mjs",
27
30
  "./guards": "./dist/guards.mjs",
@@ -32,34 +35,32 @@
32
35
  "./types": "./dist/types.mjs",
33
36
  "./package.json": "./package.json"
34
37
  },
35
- "types": "./dist/index.d.mts",
36
- "files": [
37
- "dist"
38
- ],
38
+ "dependencies": {
39
+ "p-retry": "8.0.0"
40
+ },
41
+ "devDependencies": {
42
+ "@types/node": "25.9.2",
43
+ "oxfmt": "0.54.0",
44
+ "oxlint": "1.69.0",
45
+ "oxlint-tsgolint": "0.23.0",
46
+ "publint": "0.3.21",
47
+ "tsdown": "0.22.2",
48
+ "tsnapi": "0.3.3",
49
+ "typescript": "6.0.3",
50
+ "vitest": "4.1.8"
51
+ },
39
52
  "engines": {
40
- "node": ">=20"
53
+ "node": ">=24"
41
54
  },
42
55
  "scripts": {
43
56
  "build": "tsdown",
44
57
  "dev": "tsdown --watch",
45
58
  "test": "vitest --run",
46
59
  "test:watch": "vitest",
47
- "lint": "eslint .",
60
+ "lint": "oxlint",
61
+ "lint:fix": "oxlint --fix",
62
+ "fmt": "oxfmt",
63
+ "fmt:check": "oxfmt --check",
48
64
  "typecheck": "tsc --noEmit"
49
- },
50
- "dependencies": {
51
- "p-retry": "7.1.1"
52
- },
53
- "devDependencies": {
54
- "@luxass/eslint-config": "7.0.0",
55
- "@types/node": "22.18.3",
56
- "@vitest/coverage-v8": "4.0.18",
57
- "eslint": "9.39.2",
58
- "eslint-plugin-format": "1.3.1",
59
- "publint": "0.3.17",
60
- "tsdown": "0.20.2",
61
- "typescript": "5.9.3",
62
- "vitest": "4.0.18",
63
- "vitest-package-exports": "1.2.0"
64
65
  }
65
- }
66
+ }