@ls-stack/utils 3.27.1 → 3.27.2

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.
@@ -14,7 +14,7 @@
14
14
  function filterObjectOrArrayKeys(objOrArray, options): Record<string, any> | Record<string, any>[];
15
15
  ```
16
16
 
17
- Defined in: [packages/utils/src/filterObjectOrArrayKeys.ts:58](https://github.com/lucasols/utils/blob/main/packages/utils/src/filterObjectOrArrayKeys.ts#L58)
17
+ Defined in: [packages/utils/src/filterObjectOrArrayKeys.ts:60](https://github.com/lucasols/utils/blob/main/packages/utils/src/filterObjectOrArrayKeys.ts#L60)
18
18
 
19
19
  Filters the keys of an object based on the provided patterns.
20
20
 
@@ -6,6 +6,7 @@ import {
6
6
  } from "./chunk-JF2MDHOJ.js";
7
7
 
8
8
  // src/filterObjectOrArrayKeys.ts
9
+ var ID_PROP_REGEXP = /^(id_|key_|id-|key-)|(_id|_key|-id|-key)$/i;
9
10
  function filterObjectOrArrayKeys(objOrArray, {
10
11
  filterKeys,
11
12
  rejectKeys,
@@ -197,6 +198,8 @@ function filterObjectOrArrayKeys(objOrArray, {
197
198
  return 1.5 + value.length * -0.01;
198
199
  }
199
200
  }
201
+ if (key === "id" || key === "key") return 5;
202
+ if (ID_PROP_REGEXP.test(key)) return 4.5;
200
203
  if (typeof value === "boolean") return 4;
201
204
  if (typeof value === "number") return 3.5;
202
205
  if (typeof value === "string" && value.length < 20) return 3;
@@ -64,6 +64,7 @@ function sortBy(arr, sortByValue, props = "asc") {
64
64
  }
65
65
 
66
66
  // src/filterObjectOrArrayKeys.ts
67
+ var ID_PROP_REGEXP = /^(id_|key_|id-|key-)|(_id|_key|-id|-key)$/i;
67
68
  function filterObjectOrArrayKeys(objOrArray, {
68
69
  filterKeys,
69
70
  rejectKeys,
@@ -255,6 +256,8 @@ function filterObjectOrArrayKeys(objOrArray, {
255
256
  return 1.5 + value.length * -0.01;
256
257
  }
257
258
  }
259
+ if (key === "id" || key === "key") return 5;
260
+ if (ID_PROP_REGEXP.test(key)) return 4.5;
258
261
  if (typeof value === "boolean") return 4;
259
262
  if (typeof value === "number") return 3.5;
260
263
  if (typeof value === "string" && value.length < 20) return 3;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  filterObjectOrArrayKeys
3
- } from "./chunk-TUJEGBFW.js";
3
+ } from "./chunk-J3ILVKZC.js";
4
4
  import "./chunk-SRVMMYSW.js";
5
5
  import "./chunk-C2SVCIWE.js";
6
6
  import "./chunk-JF2MDHOJ.js";
package/lib/testUtils.cjs CHANGED
@@ -156,6 +156,7 @@ function deepEqual(foo, bar, maxDepth = 20) {
156
156
  }
157
157
 
158
158
  // src/filterObjectOrArrayKeys.ts
159
+ var ID_PROP_REGEXP = /^(id_|key_|id-|key-)|(_id|_key|-id|-key)$/i;
159
160
  function filterObjectOrArrayKeys(objOrArray, {
160
161
  filterKeys,
161
162
  rejectKeys,
@@ -347,6 +348,8 @@ function filterObjectOrArrayKeys(objOrArray, {
347
348
  return 1.5 + value.length * -0.01;
348
349
  }
349
350
  }
351
+ if (key === "id" || key === "key") return 5;
352
+ if (ID_PROP_REGEXP.test(key)) return 4.5;
350
353
  if (typeof value === "boolean") return 4;
351
354
  if (typeof value === "number") return 3.5;
352
355
  if (typeof value === "string" && value.length < 20) return 3;
package/lib/testUtils.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-JQFUKJU5.js";
12
12
  import {
13
13
  filterObjectOrArrayKeys
14
- } from "./chunk-TUJEGBFW.js";
14
+ } from "./chunk-J3ILVKZC.js";
15
15
  import {
16
16
  defer
17
17
  } from "./chunk-DFXNVEH6.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ls-stack/utils",
3
3
  "description": "Universal TypeScript utilities for browser and Node.js",
4
- "version": "3.27.1",
4
+ "version": "3.27.2",
5
5
  "license": "MIT",
6
6
  "files": [
7
7
  "lib",