Returns metadata about the index of an item in a list.
const list = ['apple', 'banana', 'cherry'];const meta = getIndexMeta(1, list);console.log(meta.count); // 3console.log(meta.current); // 2console.log(meta.first); // falseconsole.log(meta.last); // falseconsole.log(meta.odd); // trueconsole.log(meta.even); // false Copy
const list = ['apple', 'banana', 'cherry'];const meta = getIndexMeta(1, list);console.log(meta.count); // 3console.log(meta.current); // 2console.log(meta.first); // falseconsole.log(meta.last); // falseconsole.log(meta.odd); // trueconsole.log(meta.even); // false
The total number of items in the list.
The current index (1-based).
Whether the index is even (0-based).
Whether this is the first item in the list.
Whether this is the last item in the list.
Whether the index is odd (0-based).
Returns metadata about the index of an item in a list.