diff --git a/src/extensions/array.js b/src/extensions/array.js index 6c383dd..e551376 100644 --- a/src/extensions/array.js +++ b/src/extensions/array.js @@ -1,3 +1,8 @@ +/** + * Check is array empty. + * @param {Array} value Array. + * @returns Boolean True, if array is empty or not an array type. + */ Array.isEmpty = function(value) { const dataType = Object.getDataType(value); if (dataType != "array") { @@ -7,6 +12,12 @@ Array.isEmpty = function(value) { return (value.length <= 0); }; +/** + * Create a linear/one-dimension array of objects from an object's property. + * @param {*} sourceArray Source array. + * @param {*} propName Property name. + * @param {*} destArray Destination array. + */ Array.toFlatten = function (sourceArray, propName, destArray) { for (let i=0; i= this.length) { + return ""; + } + + return this[index]; +}; + /** * Find index of first occurrence of value in property. * @param {string} propName Property name.