@sumaris-net/ngx-components 1.23.26 → 1.23.27
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/sumaris-net.ngx-components.umd.js +10 -7
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +5 -0
- package/esm2015/src/app/shared/functions.js +11 -8
- package/fesm2015/sumaris-net.ngx-components.js +10 -7
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/functions.d.ts +1 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -424,15 +424,18 @@
|
|
|
424
424
|
return rv;
|
|
425
425
|
}, {});
|
|
426
426
|
}
|
|
427
|
-
function arrayDistinct(
|
|
428
|
-
if (isEmptyArray(
|
|
429
|
-
return
|
|
430
|
-
properties =
|
|
427
|
+
function arrayDistinct(values, keyOrProperty) {
|
|
428
|
+
if (isEmptyArray(values))
|
|
429
|
+
return values;
|
|
430
|
+
var properties = Array.isArray(keyOrProperty) ? keyOrProperty : (!keyOrProperty && Object.keys(values[0]));
|
|
431
|
+
var computeKeyFn = typeof keyOrProperty === 'function' ? keyOrProperty :
|
|
432
|
+
(typeof keyOrProperty === 'string' ? (function (obj) { return getPropertyByPathAsString(obj, keyOrProperty); })
|
|
433
|
+
: (function (obj) { return joinPropertiesPath(obj, properties, '|'); }));
|
|
431
434
|
var existingIds = new Set();
|
|
432
|
-
return
|
|
433
|
-
var uniqueKey =
|
|
435
|
+
return values.reduce(function (res, item) {
|
|
436
|
+
var uniqueKey = computeKeyFn(item);
|
|
434
437
|
if (existingIds.has(uniqueKey))
|
|
435
|
-
return res; // Skip
|
|
438
|
+
return res; // Skip if duplicate
|
|
436
439
|
existingIds.add(uniqueKey);
|
|
437
440
|
return res.concat(item);
|
|
438
441
|
}, []);
|