@bbn/bbn 1.0.73 → 1.0.74
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/bundle.js +9 -0
- package/dist/fn/object/multiorder.js +9 -0
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -8354,6 +8354,9 @@
|
|
|
8354
8354
|
* @returns {Array} The same array (arr), ordered differently
|
|
8355
8355
|
*/
|
|
8356
8356
|
const multiorder = function (arr, orders) {
|
|
8357
|
+
if (!orders) {
|
|
8358
|
+
return arr;
|
|
8359
|
+
}
|
|
8357
8360
|
let currentOrders;
|
|
8358
8361
|
if (!Array.isArray(orders) && typeof orders === 'object') {
|
|
8359
8362
|
currentOrders = [];
|
|
@@ -8361,6 +8364,12 @@
|
|
|
8361
8364
|
currentOrders.push({ field: n, dir: orders[n] });
|
|
8362
8365
|
}
|
|
8363
8366
|
}
|
|
8367
|
+
else {
|
|
8368
|
+
currentOrders = orders;
|
|
8369
|
+
}
|
|
8370
|
+
if (!Array.isArray(currentOrders)) {
|
|
8371
|
+
throw new Error('The orders argument must be an array');
|
|
8372
|
+
}
|
|
8364
8373
|
let r = arr.slice();
|
|
8365
8374
|
return r.sort((a, b) => {
|
|
8366
8375
|
let res;
|
|
@@ -38,6 +38,9 @@ import { _compareValues } from './_compareValues';
|
|
|
38
38
|
* @returns {Array} The same array (arr), ordered differently
|
|
39
39
|
*/
|
|
40
40
|
const multiorder = function (arr, orders) {
|
|
41
|
+
if (!orders) {
|
|
42
|
+
return arr;
|
|
43
|
+
}
|
|
41
44
|
let currentOrders;
|
|
42
45
|
if (!Array.isArray(orders) && typeof orders === 'object') {
|
|
43
46
|
currentOrders = [];
|
|
@@ -45,6 +48,12 @@ const multiorder = function (arr, orders) {
|
|
|
45
48
|
currentOrders.push({ field: n, dir: orders[n] });
|
|
46
49
|
}
|
|
47
50
|
}
|
|
51
|
+
else {
|
|
52
|
+
currentOrders = orders;
|
|
53
|
+
}
|
|
54
|
+
if (!Array.isArray(currentOrders)) {
|
|
55
|
+
throw new Error('The orders argument must be an array');
|
|
56
|
+
}
|
|
48
57
|
let r = arr.slice();
|
|
49
58
|
return r.sort((a, b) => {
|
|
50
59
|
let res;
|