We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
makeOxfordList takes an array of strings and returns a single string listing each element from the array, using conjunctions and a serial comma.
items?: string[]
The items to include in the list. If not provided, returns a null string ('').
''
conjunction: string = 'and'
The conjunction to use. Exposed as a parameter to make internationalization easier.
Default: 'and'
'and'
A new string with the items listed using a conjunction and a serial comma.
import { makeOxfordList } from '@revolutionarygamesco/common' makeOxfordList() // '' makeOxfordList([]) // '' makeOxfordList(['vittles']) // 'vittles' makeOxfordList(['vittles', 'fresh water']) // 'vittles and fresh water' makeOxfordList(['vittles', 'fresh water', 'rum') // 'vittles, fresh water, and rum'