@bbn/bbn 1.0.195 → 1.0.197

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.
@@ -23,8 +23,8 @@
23
23
  * ```
24
24
  * @memberof bbn.fn
25
25
  * @param {Object} obj
26
- * @param {String} prop
26
+ * @param {String} props
27
27
  * @returns {*} The property's value or undefined
28
28
  */
29
- declare const getProperty: (obj: any, prop: any) => any;
29
+ declare const getProperty: (obj: any, ...props: any[]) => any;
30
30
  export { getProperty };
@@ -23,12 +23,20 @@
23
23
  * ```
24
24
  * @memberof bbn.fn
25
25
  * @param {Object} obj
26
- * @param {String} prop
26
+ * @param {String} props
27
27
  * @returns {*} The property's value or undefined
28
28
  */
29
- var getProperty = function (obj, prop) {
30
- if (typeof obj === 'object' && typeof prop === 'string') {
31
- return prop.split('.').reduce(function (o, i) {
29
+ var getProperty = function (obj) {
30
+ var props = [];
31
+ for (var _i = 1; _i < arguments.length; _i++) {
32
+ props[_i - 1] = arguments[_i];
33
+ }
34
+ if (typeof obj === 'object') {
35
+ var arr = [];
36
+ if (props.length === 1 && typeof props[0] === 'string') {
37
+ arr.push.apply(arr, props[0].split('.'));
38
+ }
39
+ return arr.reduce(function (o, i) {
32
40
  if (o) {
33
41
  return o[i];
34
42
  }
@@ -1,2 +1,2 @@
1
- declare const mutateArray: (a1: any, a2: any, onInsert: any) => any;
1
+ declare const mutateArray: (a1: any, a2: any) => any;
2
2
  export { mutateArray };
@@ -2,7 +2,7 @@ import { isArray } from '../type/isArray.js';
2
2
  import { hash } from '../string/hash.js';
3
3
  import { isSame } from '../type/isSame.js';
4
4
  import { search } from './search.js';
5
- var mutateArray = function (a1, a2, onInsert) {
5
+ var mutateArray = function (a1, a2) {
6
6
  if (!isArray(a1, a2)) {
7
7
  throw new TypeError('mutateArray can only be called with arrays');
8
8
  }
@@ -31,7 +31,7 @@ var mutateArray = function (a1, a2, onInsert) {
31
31
  }
32
32
  else {
33
33
  // Insert the new item from a2 into a1
34
- a1.splice(j, 0, onInsert ? onInsert(a1Ordered[j]) : a1Ordered[j]);
34
+ a1.splice(j, 0, a1Ordered[j]);
35
35
  }
36
36
  }
37
37
  }
package/dist/fn.d.ts CHANGED
@@ -113,7 +113,7 @@ declare const fn: {
113
113
  getLoader: (requestId: any) => BbnLoader;
114
114
  getPath: (element: any) => any;
115
115
  getProp: (obj: any, prop: any) => any;
116
- getProperty: (obj: any, prop: any) => any;
116
+ getProperty: (obj: any, ...props: any[]) => any;
117
117
  getRequestId: (url: any, data: any, datatype: any) => string;
118
118
  getRow: (arr: any[], prop: string | object, val?: any, operator?: string) => any;
119
119
  getScrollBarSize: () => number;
@@ -184,7 +184,7 @@ declare const fn: {
184
184
  money: (val: number, kilo?: boolean, currency?: string, novalue?: string | false, decimal?: string, thousands?: string, precision?: number) => string;
185
185
  move: (arr: any[], fromIndex: number, toIndex: number) => any[];
186
186
  multiorder: (arr: object[], orders: any) => object[];
187
- mutateArray: (a1: any, a2: any, onInsert: any) => any;
187
+ mutateArray: (a1: any, a2: any) => any;
188
188
  nl2br: (st: any, keepNl: any) => string;
189
189
  numProperties: (obj: object) => number;
190
190
  objectToFormData: (obj: any, key?: string, ignoreList?: any) => FormData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.195",
3
+ "version": "1.0.197",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",