@ls-stack/utils 3.27.0 → 3.27.1

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.
@@ -207,14 +207,15 @@ function filterObjectOrArrayKeys(objOrArray, {
207
207
  "desc"
208
208
  );
209
209
  }
210
- function sortKeysWithPatterns(keys, obj, currentPath) {
210
+ function sortKeysWithPatterns(keys_, obj, currentPath) {
211
211
  if (!sortKeys && sortPatternsParsed.length === 0) {
212
- return keys;
212
+ return keys_;
213
213
  }
214
- if (sortPatternsParsed.length === 0) {
215
- return sortKeys ? applySortKeys(keys, obj, sortKeys) : keys;
214
+ let keysToSort = keys_;
215
+ if (sortKeys) {
216
+ keysToSort = applySortKeys(keysToSort, obj, sortKeys);
216
217
  }
217
- const sortedKeys = [...keys].sort((a, b) => {
218
+ const sortedKeys = [...keysToSort].sort((a, b) => {
218
219
  const pathA = currentPath.concat({ type: "KEY", name: a });
219
220
  const pathB = currentPath.concat({ type: "KEY", name: b });
220
221
  const priorityA = getSortPriority(pathA);
@@ -265,14 +265,15 @@ function filterObjectOrArrayKeys(objOrArray, {
265
265
  "desc"
266
266
  );
267
267
  }
268
- function sortKeysWithPatterns(keys, obj, currentPath) {
268
+ function sortKeysWithPatterns(keys_, obj, currentPath) {
269
269
  if (!sortKeys && sortPatternsParsed.length === 0) {
270
- return keys;
270
+ return keys_;
271
271
  }
272
- if (sortPatternsParsed.length === 0) {
273
- return sortKeys ? applySortKeys(keys, obj, sortKeys) : keys;
272
+ let keysToSort = keys_;
273
+ if (sortKeys) {
274
+ keysToSort = applySortKeys(keysToSort, obj, sortKeys);
274
275
  }
275
- const sortedKeys = [...keys].sort((a, b) => {
276
+ const sortedKeys = [...keysToSort].sort((a, b) => {
276
277
  const pathA = currentPath.concat({ type: "KEY", name: a });
277
278
  const pathB = currentPath.concat({ type: "KEY", name: b });
278
279
  const priorityA = getSortPriority(pathA);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  filterObjectOrArrayKeys
3
- } from "./chunk-MVN6FKX7.js";
3
+ } from "./chunk-TUJEGBFW.js";
4
4
  import "./chunk-SRVMMYSW.js";
5
5
  import "./chunk-C2SVCIWE.js";
6
6
  import "./chunk-JF2MDHOJ.js";
package/lib/testUtils.cjs CHANGED
@@ -357,14 +357,15 @@ function filterObjectOrArrayKeys(objOrArray, {
357
357
  "desc"
358
358
  );
359
359
  }
360
- function sortKeysWithPatterns(keys, obj, currentPath) {
360
+ function sortKeysWithPatterns(keys_, obj, currentPath) {
361
361
  if (!sortKeys && sortPatternsParsed.length === 0) {
362
- return keys;
362
+ return keys_;
363
363
  }
364
- if (sortPatternsParsed.length === 0) {
365
- return sortKeys ? applySortKeys(keys, obj, sortKeys) : keys;
364
+ let keysToSort = keys_;
365
+ if (sortKeys) {
366
+ keysToSort = applySortKeys(keysToSort, obj, sortKeys);
366
367
  }
367
- const sortedKeys = [...keys].sort((a, b) => {
368
+ const sortedKeys = [...keysToSort].sort((a, b) => {
368
369
  const pathA = currentPath.concat({ type: "KEY", name: a });
369
370
  const pathB = currentPath.concat({ type: "KEY", name: b });
370
371
  const priorityA = getSortPriority(pathA);
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-MVN6FKX7.js";
14
+ } from "./chunk-TUJEGBFW.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.0",
4
+ "version": "3.27.1",
5
5
  "license": "MIT",
6
6
  "files": [
7
7
  "lib",