Skip to content

Commit 61d4fd0

Browse files
figoismaelga
authored andcommitted
Added move method to reorder array items.
1 parent 0ebd283 commit 61d4fd0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/types.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ var types = {
1414
array: function(fields, props) {
1515
var move = function(props, i, n) {
1616
return function(to) {
17-
if(!canMoveUp(i, n) && !canMoveDown(i, n)) return;
18-
var newList = props.getValue(props.path);
19-
var value = newList.splice(to, 1);
17+
if(!canMoveUp(i, n) && !canMoveDown(i, n)) return;
18+
var newList = props.getValue(props.path);
19+
var value = newList.splice(to, 1);
2020

21-
newList.splice(i, 0, value[0]);
22-
props.update(props.path, newList, newList);
23-
};
21+
newList.splice(i, 0, value[0]);
22+
props.update(props.path, newList, newList);
23+
};
2424
};
2525
var canMoveUp = function(i, n) {
2626
return i > 0 && i < n - 1;

0 commit comments

Comments
 (0)