From 1a65a3151569f88adde8f3840d0e39684d1d5bf7 Mon Sep 17 00:00:00 2001 From: Arnelle Balane Date: Tue, 26 Feb 2019 11:14:54 +0800 Subject: [PATCH] Add esdoc comments for .eachIndex() method --- methods/eachIndex/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/methods/eachIndex/index.js b/methods/eachIndex/index.js index 99d54e8..901fe52 100644 --- a/methods/eachIndex/index.js +++ b/methods/eachIndex/index.js @@ -1,3 +1,18 @@ +/** + * Iterates the items of the array and passes their index to the callback. + * + * @param {Array} array + * @param {Function} callback - The function that will be passed the indeces + * of each array item. + * + * @return {Array} The original given array. + * + * @example + * eachIndex(['a', 'b', 'c'], i => console.log(i)); // prints: 0 1 2 + * + * @example + * rbjs(['a', 'b', 'c']).eachIndex(i => console.log(i)); // prints: 0 1 2 + */ export default function eachIndex(array, callback) { if (typeof callback !== 'function') { throw new TypeError('Parameter "callback" must be a function.');