Skip to content

Commit

Permalink
docs: fixed typo conjuction -> conjunction
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce authored and dustinspecker committed Jun 12, 2019
1 parent 2fb6d99 commit 4e9f6d9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions readme.md
Expand Up @@ -15,23 +15,23 @@ npm install --save array-join-conjunction
## Usage

```javascript
import arrayJoinConjuction from 'array-join-conjunction'
import arrayJoinConjunction from 'array-join-conjunction'

arrayJoinConjuction([])
arrayJoinConjunction([])
// => ''

arrayJoinConjuction([1, 2])
arrayJoinConjunction([1, 2])
// => '1 and 2'

arrayJoinConjuction(['blue', 'red', 'green'])
arrayJoinConjunction(['blue', 'red', 'green'])
// => 'blue, red, and green'

arrayJoinConjuction(['blue', 'red', 'green'], 'or')
arrayJoinConjunction(['blue', 'red', 'green'], 'or')
// => 'blue, red, or green'
```

## API
### arrayJoinConjuction(array, [conjunction])
### arrayJoinConjunction(array, [conjunction])

Returns a `string` joined from `array` using an optional `conjunction`.

Expand Down
24 changes: 12 additions & 12 deletions tests/test.js
@@ -1,34 +1,34 @@
import test from 'ava'

import arrayJoinConjuction from '../lib'
import arrayJoinConjunction from '../lib'

test('throws a TypeError if an array is not passed', t => {
const noArray = () => arrayJoinConjuction()
const noArray = () => arrayJoinConjunction()

t.throws(noArray, TypeError)
t.throws(noArray, /Expected an array to be provided/)
})

test('returns empty string when empty array', t => {
t.is(arrayJoinConjuction([]), '')
t.is(arrayJoinConjunction([]), '')
})

test('returns a single value if array has one value', t => {
t.is(arrayJoinConjuction(['hi']), 'hi')
t.is(arrayJoinConjuction([3]), 3)
t.is(arrayJoinConjunction(['hi']), 'hi')
t.is(arrayJoinConjunction([3]), 3)
})

test('returns two words joined with `and` when array has 2 values', t => {
t.is(arrayJoinConjuction(['red', 'green']), 'red and green')
t.is(arrayJoinConjuction([1, 2]), '1 and 2')
t.is(arrayJoinConjunction(['red', 'green']), 'red and green')
t.is(arrayJoinConjunction([1, 2]), '1 and 2')
})

test('returns more than two words with comma and `and`', t => {
t.is(arrayJoinConjuction(['red', 'green', 'blue']), 'red, green, and blue')
t.is(arrayJoinConjuction([1, 2, 3, 4, 5]), '1, 2, 3, 4, and 5')
t.is(arrayJoinConjunction(['red', 'green', 'blue']), 'red, green, and blue')
t.is(arrayJoinConjunction([1, 2, 3, 4, 5]), '1, 2, 3, 4, and 5')
})

test('supports optional conjuction', t => {
t.is(arrayJoinConjuction([1, 2], 'or'), '1 or 2')
t.is(arrayJoinConjuction(['red', 'green', 'blue'], 'or'), 'red, green, or blue')
test('supports optional conjunction', t => {
t.is(arrayJoinConjunction([1, 2], 'or'), '1 or 2')
t.is(arrayJoinConjunction(['red', 'green', 'blue'], 'or'), 'red, green, or blue')
})

0 comments on commit 4e9f6d9

Please sign in to comment.