UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

19 lines (15 loc) 447 B
import { assert } from "../../assert.js"; /** * @template T * @param {T[]} array * @param {number} index0 * @param {number} index1 */ export function array_swap_one(array, index0, index1) { assert.isArrayLike(array, 'array'); assert.isNonNegativeInteger(index0, 'index0'); assert.isNonNegativeInteger(index1, 'index1'); const t = array[index0]; array[index0] = array[index1]; array[index1] = t; }