@stemy/ngx-utils 12.2.13 → 12.2.15
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/bundles/stemy-ngx-utils.umd.js +12 -18
- package/bundles/stemy-ngx-utils.umd.js.map +1 -1
- package/esm2015/ngx-utils/pipes/filter.pipe.js +6 -11
- package/esm2015/ngx-utils/pipes/find.pipe.js +9 -9
- package/fesm2015/stemy-ngx-utils.js +13 -18
- package/fesm2015/stemy-ngx-utils.js.map +1 -1
- package/ngx-utils/pipes/find.pipe.d.ts +1 -1
- package/package.json +1 -1
|
@@ -4395,25 +4395,20 @@
|
|
|
4395
4395
|
var isObject = ObjectUtils.isObject(values);
|
|
4396
4396
|
if (!isObject && !ObjectUtils.isArray(values))
|
|
4397
4397
|
return [];
|
|
4398
|
-
var filterFunc = ObjectUtils.isFunction(filter) ? filter : function (value, key, params) {
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
key: key,
|
|
4402
|
-
item: value,
|
|
4403
|
-
index: key,
|
|
4404
|
-
params: params
|
|
4405
|
-
});
|
|
4398
|
+
var filterFunc = ObjectUtils.isFunction(filter) ? filter : function (value, key, params, values) {
|
|
4399
|
+
var index = key;
|
|
4400
|
+
return ObjectUtils.evaluate(filter, { value: value, key: key, params: params, values: values, index: index });
|
|
4406
4401
|
};
|
|
4407
4402
|
if (isObject) {
|
|
4408
4403
|
return Object.keys(values).filter(function (key) {
|
|
4409
|
-
return filterFunc(values[key], key, params);
|
|
4404
|
+
return filterFunc(values[key], key, params, values);
|
|
4410
4405
|
}).reduce(function (result, key) {
|
|
4411
4406
|
result[key] = values[key];
|
|
4412
4407
|
return result;
|
|
4413
4408
|
}, {});
|
|
4414
4409
|
}
|
|
4415
4410
|
return values.filter(function (value, key) {
|
|
4416
|
-
return filterFunc(value, key, params);
|
|
4411
|
+
return filterFunc(value, key, params, values);
|
|
4417
4412
|
});
|
|
4418
4413
|
};
|
|
4419
4414
|
return FilterPipe;
|
|
@@ -4432,17 +4427,16 @@
|
|
|
4432
4427
|
}
|
|
4433
4428
|
FindPipe.prototype.transform = function (values, filter, params) {
|
|
4434
4429
|
if (filter === void 0) { filter = defaultFilter; }
|
|
4435
|
-
if (params === void 0) { params = {}; }
|
|
4436
4430
|
if (!ObjectUtils.isArray(values))
|
|
4437
4431
|
return [];
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
});
|
|
4432
|
+
params = params || {};
|
|
4433
|
+
if (ObjectUtils.isObject(params)) {
|
|
4434
|
+
params.values = values;
|
|
4435
|
+
}
|
|
4436
|
+
var filterFunc = ObjectUtils.isFunction(filter) ? filter : function (value, index, params, values) {
|
|
4437
|
+
return ObjectUtils.evaluate(filter, { value: value, index: index, params: params, values: values });
|
|
4444
4438
|
};
|
|
4445
|
-
return values.find(function (value, index) { return filterFunc(value, index, params); });
|
|
4439
|
+
return values.find(function (value, index) { return filterFunc(value, index, params, values); });
|
|
4446
4440
|
};
|
|
4447
4441
|
return FindPipe;
|
|
4448
4442
|
}());
|