Created
April 11, 2016 13:32
-
-
Save jurassix/21efce844fa0718641452647b603d97d 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 joinArray = (list = [], separator) => | |
list.reduce((joinedList, item, index, {length}) => { | |
joinedList.push(item); | |
if (index < (length - 1)) { | |
joinedList.push(separator); | |
} | |
return joinedList; | |
}, []); |
Author
jurassix
commented
Apr 11, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment