UNPKG

primrose

Version:

Syntax-highlighting text editor that renders to an HTML5 Canvas element

13 lines (12 loc) 358 B
/** * Removes an item at the given index from an array. * @param {any[]} arr * @param {number} idx * @returns {any} - the item that was removed. */ export function arrayRemoveAt(arr, idx) { if (!(arr instanceof Array)) { throw new Error("Must provide an array as the first parameter."); } return arr.splice(idx, 1); }