diff --git a/package.json b/package.json index 0dcb509..4e821d1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "LiteRyzJS", - "version": "0.1.0.424", + "version": "0.1.0.455", "devDependencies": { "css-loader": "^7.1.2", "sass": "^1.77.8", diff --git a/src/extensions/array.js b/src/extensions/array.js index 1aad74c..38eaab4 100644 --- a/src/extensions/array.js +++ b/src/extensions/array.js @@ -4,6 +4,10 @@ * @returns Boolean True, if array is empty or not an array type. */ Array.isEmpty = function(value) { + if (typeof(value) == "undefined") { + return true; + } + const dataType = Object.getDataType(value); if (dataType != "array") { return true; @@ -160,12 +164,12 @@ Array.prototype.create = function (length, value) { return result }; -Array.prototype.distinct = function () { - this = this.filter((obj, index, self) => +Array.prototype.distinct = function() { + let result = this.filter((obj, index, self) => index === self.findIndex((x) => JSON.stringify(x) === JSON.stringify(obj)) ); - return this; + return result; } /**