Comparing version 4.58.2 to 4.58.3
@@ -47,2 +47,13 @@ 'use strict'; | ||
/* --------------------- move --------------------- */ | ||
var ldmove = function ldmove(arr, fromIndex, toIndex) { | ||
if (Array.isArray(arr) && fromIndex < arr.length && toIndex < arr.length) { | ||
var item = arr.splice(fromIndex, 1)[0]; | ||
arr.splice(toIndex, 0, item); | ||
} else { | ||
// Handle invalid operation more gracefully in real scenarios | ||
console.warn("Attempted to move from ".concat(fromIndex, " to ").concat(toIndex, " but the operation is not valid.")); | ||
} | ||
}; | ||
/* --------------------- has --------------------- */ | ||
@@ -273,4 +284,2 @@ | ||
} | ||
// Very important ;) | ||
}, { | ||
@@ -289,2 +298,14 @@ key: "swap", | ||
} | ||
}, { | ||
key: "move", | ||
value: function move(object, path, fromIndex, toIndex) { | ||
console.log('Moving:', path, fromIndex, 'to', toIndex); | ||
// Get the array at the specified path | ||
var arr = ldget(object, path); | ||
console.log('Array before move', JSON.stringify(arr)); | ||
// Use ldmove to perform the operation | ||
ldmove(arr, fromIndex, toIndex); | ||
console.log('Array after move', JSON.stringify(arr)); | ||
} | ||
}]); | ||
@@ -291,0 +312,0 @@ return ObjectMap; |
@@ -43,2 +43,13 @@ import { createClass as _createClass, typeof as _typeof, classCallCheck as _classCallCheck } from './_virtual/_rollupPluginBabelHelpers.js'; | ||
/* --------------------- move --------------------- */ | ||
var ldmove = function ldmove(arr, fromIndex, toIndex) { | ||
if (Array.isArray(arr) && fromIndex < arr.length && toIndex < arr.length) { | ||
var item = arr.splice(fromIndex, 1)[0]; | ||
arr.splice(toIndex, 0, item); | ||
} else { | ||
// Handle invalid operation more gracefully in real scenarios | ||
console.warn("Attempted to move from ".concat(fromIndex, " to ").concat(toIndex, " but the operation is not valid.")); | ||
} | ||
}; | ||
/* --------------------- has --------------------- */ | ||
@@ -269,4 +280,2 @@ | ||
} | ||
// Very important ;) | ||
}, { | ||
@@ -285,2 +294,14 @@ key: "swap", | ||
} | ||
}, { | ||
key: "move", | ||
value: function move(object, path, fromIndex, toIndex) { | ||
console.log('Moving:', path, fromIndex, 'to', toIndex); | ||
// Get the array at the specified path | ||
var arr = ldget(object, path); | ||
console.log('Array before move', JSON.stringify(arr)); | ||
// Use ldmove to perform the operation | ||
ldmove(arr, fromIndex, toIndex); | ||
console.log('Array after move', JSON.stringify(arr)); | ||
} | ||
}]); | ||
@@ -287,0 +308,0 @@ return ObjectMap; |
{ | ||
"name": "informed", | ||
"version": "4.58.2", | ||
"version": "4.58.3", | ||
"description": "A lightweight framework and utility for building powerful forms in React applications", | ||
@@ -141,3 +141,5 @@ "type": "module", | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0", | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0" | ||
}, | ||
"optionalDependencies": { | ||
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" | ||
@@ -144,0 +146,0 @@ }, |
@@ -252,3 +252,3 @@ # Informed | ||
**Note:** some things were left out as they are not super important or are going to be depricated or removed in future. | ||
**Note:** some things were left out as they are not super important or are going to be deprecated or removed in future. | ||
@@ -255,0 +255,0 @@ ```bash |
608359
15316