0.0.1 • Published 4 years ago
word-join v0.0.1
word-join
Installation
npm install word-joinUsage
import wordJoin from 'word-join'
wordJoin(['pasta', 'sauce', 'cheese', 'wine'])
// pasta, sauce, cheese and wine
wordJoin(['pasta', 'sauce', 'cheese', 'wine'], {
conjunction: 'or'
})
// pasta, sauce, cheese or wine
wordJoin(['pasta', 'sauce', 'cheese', 'wine'], {
conjunction: 'or',
oxford: true
})
// pasta, sauce, cheese, or wine
wordJoin(['pasta', 'sauce', 'cheese', 'wine'], {
conjunction: 'or',
oxford: true,
separator: ';'
})
// pasta; sauce; cheese; or wineOptions
conjunction
Type: string. Default: 'and'.
The conjunction to join the last word of the sentence.
wordJoin(['pasta', 'sauce', 'cheese', 'wine'], { conjunction: 'or' })
// pasta, sauce, cheese or wineoxford
Type: boolean. Default: false.
Whether to use an Oxford comma or not — i.e. a last comma before the conjunction.
wordJoin(['pasta', 'sauce', 'cheese', 'wine'], { oxford: true })
// pasta, sauce, cheese, and wineseparator
Type: string. Default: ','.
String to separate the list items.
wordJoin(['pasta', 'sauce', 'cheese', 'wine'], { separator: ';' })
// pasta; sauce; cheese and wineLicense
0.0.1
4 years ago