arcade-physics
Version:
Use Arcade Physics without Phaser.
32 lines • 947 B
JavaScript
;
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.MoveDown = void 0;
/**
* Moves the given array element down one place in the array.
* The array is modified in-place.
*
* @function Phaser.Utils.Array.MoveDown
* @since 3.4.0
*
* @param {array} array - The input array.
* @param {*} item - The element to move down the array.
*
* @return {array} The input array.
*/
const MoveDown = (array, item) => {
const currentIndex = array.indexOf(item);
if (currentIndex > 0) {
const item2 = array[currentIndex - 1];
const index2 = array.indexOf(item2);
array[currentIndex] = item2;
array[index2] = item;
}
return array;
};
exports.MoveDown = MoveDown;
//# sourceMappingURL=MoveDown.js.map