Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

array-join-conjunction

1.0.0 • Public • Published

array-join-conjunction

NPM version Build Status Coverage Status

Code Climate Dependencies DevDependencies

Join an array with a conjunction

Install

npm install --save array-join-conjunction

Usage

import arrayJoinConjuction from 'array-join-conjunction'
 
arrayJoinConjuction([])
// => ''
 
arrayJoinConjuction([1, 2])
// => '1 and 2'
 
arrayJoinConjuction(['blue', 'red', 'green'])
// => 'blue, red, and green'
 
arrayJoinConjuction(['blue', 'red', 'green'], 'or')
// => 'blue, red, or green'

API

arrayJoinConjuction(array, [conjunction])

Returns a string joined from array using an optional conjunction.

array

type: array

The array to join into a string. An empty array returns an empty string.

conjunction

type: string

default: 'and'

A conjunction to join two or more words with. The default is to use 'and'.

License

MIT © Dustin Specker

Install

npm i array-join-conjunction

DownloadsWeekly Downloads

105

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar