I have an array
[ {name: "A", isMoveable: true},
{name: "B", isMoveable: true},
{name: "C", isMoveable: false},
{name: "D", isMoveable: true},
{name: "E", isMoveable: false}
]
I have drag and drop
so we need an algorithm that moves elements, those with isMoveable: true
while keeping elements with isMoveable: false at the same indexes
for example, if I move A before C, it will be like this
[B,A,C,D,E]
if A in place of D, then
[D,B,C,A,E]