UNPKG

@n3okill/utils

Version:
21 lines 627 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.delIndex = delIndex; /** * Delete the item at the given array index * @param arr Array where index will be removed * @param index The index to remove * @returns Array with index removed */ function delIndex(arr, index) { const length = arr.length; if (index < length && index > 0) { for (let i = index + 1; i < length; i++) { // eslint-disable-next-line security/detect-object-injection arr[i - 1] = arr[i]; } arr.pop(); } return arr; } //# sourceMappingURL=delIndex.js.map