@bbn/bbn 1.0.72 → 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.d.ts CHANGED
@@ -3918,7 +3918,7 @@ declare module "fn/object/multiorder" {
3918
3918
  * @param {Array|Object} orders The properties and directions (asc, desc) to order by
3919
3919
  * @returns {Array} The same array (arr), ordered differently
3920
3920
  */
3921
- const multiorder: (arr: object[], orders: object | BbnOrderItem[]) => object[];
3921
+ const multiorder: (arr: object[], orders: any) => object[];
3922
3922
  export { multiorder };
3923
3923
  }
3924
3924
  declare module "fn/string/nl2br" {
@@ -4828,7 +4828,7 @@ declare module "fn" {
4828
4828
  md5: (st: any) => string;
4829
4829
  money: (val: number, kilo?: boolean, currency?: string, novalue?: string | false, decimal?: string, thousands?: string, precision?: number) => string;
4830
4830
  move: (arr: any[], fromIndex: number, toIndex: number) => any[];
4831
- multiorder: (arr: object[], orders: object | BbnOrderItem[]) => object[];
4831
+ multiorder: (arr: object[], orders: any) => object[];
4832
4832
  nl2br: (st: any, keepNl: any) => string;
4833
4833
  numProperties: (obj: object) => number;
4834
4834
  objectToFormData: (obj: object, key?: string, ignoreList?: string[]) => FormData;
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;
@@ -36,5 +36,5 @@
36
36
  * @param {Array|Object} orders The properties and directions (asc, desc) to order by
37
37
  * @returns {Array} The same array (arr), ordered differently
38
38
  */
39
- declare const multiorder: (arr: object[], orders: object | BbnOrderItem[]) => object[];
39
+ declare const multiorder: (arr: object[], orders: any) => object[];
40
40
  export { multiorder };
@@ -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;
package/dist/fn.d.ts CHANGED
@@ -181,7 +181,7 @@ declare const fn: {
181
181
  md5: (st: any) => string;
182
182
  money: (val: number, kilo?: boolean, currency?: string, novalue?: string | false, decimal?: string, thousands?: string, precision?: number) => string;
183
183
  move: (arr: any[], fromIndex: number, toIndex: number) => any[];
184
- multiorder: (arr: object[], orders: object | BbnOrderItem[]) => object[];
184
+ multiorder: (arr: object[], orders: any) => object[];
185
185
  nl2br: (st: any, keepNl: any) => string;
186
186
  numProperties: (obj: object) => number;
187
187
  objectToFormData: (obj: object, key?: string, ignoreList?: string[]) => FormData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.72",
3
+ "version": "1.0.74",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",