@kizmann/pico-js 0.5.4 → 0.5.5

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.5.4",
3
+ "version": "0.5.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
@@ -281,15 +281,23 @@ export class Obj
281
281
 
282
282
  static filter(obj, filter)
283
283
  {
284
- return Obj.each(Obj.filterIndex(obj, filter), (key) => {
285
- return obj[key];
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
  }