Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
export const contains = (list = [], test) => list.indexOf(test) >= 0;
export const removeItemAt = (list = [], index = 0) =>
[
...list.slice(0, index),
...list.slice(index + 1),
];
export const insertItemAt = (list = [], index = 0, item) =>
[
...list.slice(0, index),
item,
...list.slice(index),
];
export const replaceItemAt = (list = [], index = 0, item) =>
[
...list.slice(0, index),
item,
...list.slice(index + 1),
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.