Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am kziv on github.
* I am kziv (https://keybase.io/kziv) on keybase.
* I have a public key ASAU15Tjxp5xpKHwhWrB1EIMMmG_lSWvt4_yUFLTULaalQo
To claim this, I am signing this object:
@kziv
kziv / gist:3722e568c2d6f0f5c35982e4651e601b
Last active October 19, 2018 15:51
joinWithConjunction
joinWithConjunction(arr, delimiter, conjunction = 'and', useOxfordComma = true) {
switch (arr.length) {
case 0:
case 1:
// Use join behavior for these
return arr.join(delimiter);
case 2:
return arr.join(` ${conjunction} `);
default:
// We don't use a space between the two to make it work like String.join()