We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a60c54 commit 45bd0a9Copy full SHA for 45bd0a9
1 file changed
index.js
@@ -1451,6 +1451,22 @@ ArrayTome.prototype.rename = function () {
1451
return this;
1452
};
1453
1454
+ArrayTome.prototype.move = function (key, newKey) {
1455
+ var changes = {};
1456
+ changes[key] = newKey;
1457
+
1458
+ if (newKey > key) {
1459
+ for (let i = key; i < newKey; i++) {
1460
+ changes[i + 1] = i.toString();
1461
+ }
1462
+ } else if (newKey < key) {
1463
+ for (let i = newKey; i < key; i++) {
1464
+ changes[i] = (i + 1).toString();
1465
1466
1467
1468
+ return this.rename(changes);
1469
+};
1470
1471
ArrayTome.prototype.sort = function () {
1472
this._arr.sort.apply(this._arr, arguments);
0 commit comments