From 1d9c6bd14693123fab5fcbdd18f9f2c627226633 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 28 Aug 2024 20:16:58 +0100 Subject: [PATCH] Added doc comments for array --- src/extensions/array.js | 60 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) 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.