Skip to content

Commit

Permalink
moveItemInArray: add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunanoordin committed Nov 16, 2023
1 parent db2d98a commit 19f53be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export default function TasksPage() {
}

function moveStep(from, to) {
console.log('+++ moveStep: ', from, to);
const oldSteps = workflow?.steps || [];
if (from < 0 || to < 0 || from >= oldSteps.length || to >= oldSteps.length) return;

Expand Down
4 changes: 4 additions & 0 deletions app/pages/lab-pages-editor/helpers/moveItemInArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Moves an item in an array.
- Input: array of whatever, index of item to be moved from, index to move item to.
- Output: returns a COPY of the array, with the items moved.
Examples:
- moveItemInArray(['a','b','c','d','e'], 2, 3) => ['a', 'b', 'd', 'c', 'e']
- moveItemInArray(['a','b','c','d','e'], 2, 1) => ['a', 'c', 'b', 'd', 'e']
*/

export default function moveItemInArray(
Expand Down

0 comments on commit 19f53be

Please sign in to comment.