@kizmann/pico-js 0.5.4 → 0.5.5
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/pico-js.js +1 -1
- package/dist/pico-js.js.map +1 -1
- package/package.json +1 -1
- package/src/utility/object.js +10 -2
package/package.json
CHANGED
package/src/utility/object.js
CHANGED
@@ -281,15 +281,23 @@ export class Obj
|
|
281
281
|
|
282
282
|
static filter(obj, filter)
|
283
283
|
{
|
284
|
-
|
285
|
-
|
284
|
+
let result = {};
|
285
|
+
|
286
|
+
Obj.each(Obj.filterIndex(obj, filter), (key) => {
|
287
|
+
result[key] = obj[key];
|
286
288
|
});
|
289
|
+
|
290
|
+
return result;
|
287
291
|
}
|
288
292
|
|
289
293
|
static filterIndex(obj, filter)
|
290
294
|
{
|
291
295
|
return Any.keys(obj).filter((key) => {
|
292
296
|
|
297
|
+
if ( typeof filter === "undefined" ) {
|
298
|
+
return Any.isEmpty(obj[key]);
|
299
|
+
}
|
300
|
+
|
293
301
|
if ( Any.isFunction(filter) ) {
|
294
302
|
return filter.call({}, obj[key], key);
|
295
303
|
}
|