fluid-dnd
Version:
An agnostic drag and drop library to sort all kind of lists. With current support for vue, react and svelte
20 lines (19 loc) • 540 B
JavaScript
export const removeAtEventOnList = (list, index) => {
const listValue = list.value;
if (listValue.length <= 0) {
return;
}
const [deletedItem] = listValue.splice(index, 1);
return deletedItem;
};
export const onInsertEventOnList = (list, index, value) => {
const listValue = list.value;
listValue.splice(index, 0, value);
};
export const getLength = (list) => {
const listValue = list.value;
return listValue.length;
};
export const getValue = (list, index) => {
return list.value[index];
};