Added distinct array
This commit is contained in:
parent
c4434e1b2b
commit
993a2eef96
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "LiteRyzJS",
|
||||
"version": "0.1.0.397",
|
||||
"version": "0.1.0.424",
|
||||
"devDependencies": {
|
||||
"css-loader": "^7.1.2",
|
||||
"sass": "^1.77.8",
|
||||
|
@ -160,6 +160,14 @@ Array.prototype.create = function (length, value) {
|
||||
return result
|
||||
};
|
||||
|
||||
Array.prototype.distinct = function () {
|
||||
this = this.filter((obj, index, self) =>
|
||||
index === self.findIndex((x) => JSON.stringify(x) === JSON.stringify(obj))
|
||||
);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert this array of objects to a linear/one-dimensional array using a property.
|
||||
* @param {*} propName Property name.
|
||||
|
Loading…
Reference in New Issue
Block a user