moy-dom
Version:
A flexiable Virtual DOM library for building modern web interface.
16 lines • 584 B
JavaScript
/**
* [move move list two item]
* @param {[Number]} newIndex [toIndex]
* @param {[Number]} simulateFindIndex [fromIndex]
* @param {[Array]} simulateList [List]
* @param {[changes]} changes [changes]
* @return {[unfined]} [undefined]
*/
export default function move(newIndex, simulateFindIndex, simulateList, changes){
[simulateList[newIndex], simulateList[simulateFindIndex]] = [simulateList[simulateFindIndex], simulateList[newIndex]]
changes.push({
type: 1,
toIndex: newIndex,
fromIndex: simulateFindIndex,
})
}