Skip to content

Instantly share code, notes, and snippets.

@daybrush
Last active July 4, 2019 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daybrush/d67b13d3327fb50782a9bbc0e8f666d7 to your computer and use it in GitHub Desktop.
Save daybrush/d67b13d3327fb50782a9bbc0e8f666d7 to your computer and use it in GitHub Desktop.
const { removed, added, ordered, pureChanged, list } = result;
removed.forEach(index => {
inst.remove(index);
});
ordered.forEach(([from, to], i) => {
inst.remove(from);
inst.insert(to, list[pureChanged[i][1]]);
});
added.forEach(index => {
inst.insert(index, list[index]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment