/** * Utilities for working with arrays. Access this module by importing from * `@sirpepe/shed/array`. */ /** * Moves an element from one position in an array to another position, operating * in-place. See `moved()` for an immutable variant of this function. * * Example: * * ```javascript * let input = [0, 1, 2, 3, 4]; * move(input, 1, 3); * // input is now [0, 2, 3, 1, 4] * ``` * * Negative `from` indices pick an element from the end of the array. Indices * that out of bound are truncated to the nearest valid index - this function * will never yield a sparse array. */ export declare function move(arr: T[], from: number, to: number): T[]; /** * Moves an element from one position in an array to another position, creating * a new array. See `move()` for a mutating variant of this function. * * Example: * * ```javascript * let input = [0, 1, 2, 3, 4]; * output = moved(input, 1, 3); * // output is [0, 2, 3, 1, 4], input stays the same * ``` * * Negative `from` indices pick an element from the end of the array. Indices * that out of bound are truncated to the nearest valid index - this function * will never yield a sparse array. */ export declare function moved(arr: T[], from: number, to: number): T[]; /** * Returns an inclusive range of numbers. If one one argument is provided, the * range starts at 0 if the argument is positive. If the argument is negative, * the range ends at 0. */ export declare function range(from: number): number[]; export declare function range(from: number, to: number): number[];