@kizmann/pico-js 0.3.18 → 0.3.19

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kizmann/pico-js",
3
- "version": "0.3.18",
3
+ "version": "0.3.19",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "author": "Eduard Kizmann <kizmann@protonmail.ch>",
@@ -26,17 +26,23 @@ export class Obj
26
26
  keys = [keys];
27
27
  }
28
28
 
29
- let key = keys.shift();
29
+ let result = [];
30
+
31
+ Arr.each(keys, (key) => {
32
+ result = result.concat(key.split('.'))
33
+ });
34
+
35
+ let key = result.shift();
30
36
 
31
37
  if ( typeof obj[key] === 'undefined' ) {
32
38
  return fallback;
33
39
  }
34
40
 
35
- if ( keys.length === 0 ) {
41
+ if ( result.length === 0 ) {
36
42
  return obj[key];
37
43
  }
38
44
 
39
- return this.get(obj[key], keys, fallback)
45
+ return this.get(obj[key], result, fallback);
40
46
  }
41
47
 
42
48
  static set(obj, keys, val)
@@ -86,7 +92,7 @@ export class Obj
86
92
  }
87
93
  });
88
94
 
89
- if ( ! Any.isEmpty(assign) ) {
95
+ if ( !Any.isEmpty(assign) ) {
90
96
  result = this.assign(result, assign);
91
97
  }
92
98
 
@@ -103,7 +109,7 @@ export class Obj
103
109
  }
104
110
  });
105
111
 
106
- if ( ! Any.isEmpty(assign) ) {
112
+ if ( !Any.isEmpty(assign) ) {
107
113
  result = this.assign(result, assign);
108
114
  }
109
115
 
@@ -148,7 +154,7 @@ export class Obj
148
154
  });
149
155
  }
150
156
 
151
- if ( ! Any.isFunction(key) ) {
157
+ if ( !Any.isFunction(key) ) {
152
158
  keys = keys.sort((a, b) => {
153
159
  return Any.integer(Obj.get(obj[a], key)) - Any.integer(Obj.get(obj[b], key));
154
160
  })
@@ -168,13 +174,13 @@ export class Obj
168
174
  {
169
175
  let keys = Any.keys(obj);
170
176
 
171
- if ( ! Any.isFunction(key) ) {
177
+ if ( !Any.isFunction(key) ) {
172
178
  keys = keys.sort((a, b) => {
173
179
 
174
180
  let va = Any.string(Obj.get(obj[a], key)).toLowerCase();
175
181
  let vb = Any.string(Obj.get(obj[b], key)).toLowerCase();
176
182
 
177
- return(va < vb) ? -1 : (va > vb) ? 1 : 0;
183
+ return (va < vb) ? - 1 : (va > vb) ? 1 : 0;
178
184
  })
179
185
  }
180
186
 
@@ -265,8 +271,7 @@ export class Obj
265
271
 
266
272
  if ( obj instanceof FormData ) {
267
273
 
268
- for (let [key, value] of obj.entries())
269
- {
274
+ for ( let [key, value] of obj.entries() ) {
270
275
  result[key] = callback(value, key);
271
276
  }
272
277