Package Exports
- conjunct
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (conjunct) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
conjunct
Glue array items together, with a different glue for the last pair.
API
This module exports one function that also holds some convenience functions:
conj(list[, fin=' and/or '[, glue=', '[, serial='']]])
The list must support Array-like .slice() and .join().
- For a single item list, returns the first item verbatim.
- For an empty list, returns the empty string.
- For a list with two items, returns them joined by
fin. - For a list with three or more items, returns them concatenated
by
serial + finfor the last pair, andgluefor all other gaps.- Set
serialto','to achieve a serial comma (also Oxford comma or Harvard comma).
- Set
No spaces are added except those contained in fin/glue/serial.
conj.a(list)
Convenience function for fin = ' and ' and defaults for everything else.
conj.o(list)
Convenience function for fin = ' or ' and defaults for everything else.
conj.s(finWord, list)
Convenience function for easy serial comma.
Uses fin = ' ' + finWord + ' ', i.e. one space character is added
to each side of your finWord.
conj.sa(list)
Convenience function for fin = ' and ' and `serial = ','.
conj.so(list)
Convenience function for fin = ' or ' and `serial = ','.
Usage
see test.usage.js.
Known issues
- Needs more/better tests and docs.
License
ISC