Created
April 5, 2016 15:33
-
-
Save jurassix/6658fb564a6349afeae434e5907004c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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