PluginProbe
Block Animations, Motion & Scroll Effects – Ghost Kit / 3.7.0
Block Animations, Motion & Scroll Effects – Ghost Kit v3.7.0
3.7.2 3.7.1 3.7.0 3.6.1 trunk 1.6.3 2.25.0 3.3.0 3.3.1 3.3.2 3.3.3 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.5.0 3.5.1 3.6.0
ghostkit / gutenberg / utils / array-move / index.js

index.js in Block Animations, Motion & Scroll Effects – Ghost Kit 3.7.0, at gutenberg/utils/array-move/index.js

18 lines 373 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Move array element from one index to another.
3 *
4 * @param {Array} arr - array.
5 * @param {Int} fromIndex - from index.
6 * @param {Int} toIndex - to index.
7 *
8 * @return {Array}
9 */
10 export default function arrayMove(arr, fromIndex, toIndex) {
11 const element = arr[fromIndex];
12
13 arr.splice(fromIndex, 1);
14 arr.splice(toIndex, 0, element);
15
16 return arr;
17 }
18