@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(
|
|
210
|
+
function sortKeysWithPatterns(keys_, obj, currentPath) {
|
|
211
211
|
if (!sortKeys && sortPatternsParsed.length === 0) {
|
|
212
|
-
return
|
|
212
|
+
return keys_;
|
|
213
213
|
}
|
|
214
|
-
|
|
215
|
-
|
|
214
|
+
let keysToSort = keys_;
|
|
215
|
+
if (sortKeys) {
|
|
216
|
+
keysToSort = applySortKeys(keysToSort, obj, sortKeys);
|
|
216
217
|
}
|
|
217
|
-
const sortedKeys = [...
|
|
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(
|
|
268
|
+
function sortKeysWithPatterns(keys_, obj, currentPath) {
|
|
269
269
|
if (!sortKeys && sortPatternsParsed.length === 0) {
|
|
270
|
-
return
|
|
270
|
+
return keys_;
|
|
271
271
|
}
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
let keysToSort = keys_;
|
|
273
|
+
if (sortKeys) {
|
|
274
|
+
keysToSort = applySortKeys(keysToSort, obj, sortKeys);
|
|
274
275
|
}
|
|
275
|
-
const sortedKeys = [...
|
|
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);
|
package/lib/testUtils.cjs
CHANGED
|
@@ -357,14 +357,15 @@ function filterObjectOrArrayKeys(objOrArray, {
|
|
|
357
357
|
"desc"
|
|
358
358
|
);
|
|
359
359
|
}
|
|
360
|
-
function sortKeysWithPatterns(
|
|
360
|
+
function sortKeysWithPatterns(keys_, obj, currentPath) {
|
|
361
361
|
if (!sortKeys && sortPatternsParsed.length === 0) {
|
|
362
|
-
return
|
|
362
|
+
return keys_;
|
|
363
363
|
}
|
|
364
|
-
|
|
365
|
-
|
|
364
|
+
let keysToSort = keys_;
|
|
365
|
+
if (sortKeys) {
|
|
366
|
+
keysToSort = applySortKeys(keysToSort, obj, sortKeys);
|
|
366
367
|
}
|
|
367
|
-
const sortedKeys = [...
|
|
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