Skip to content

Commit

Permalink
feat(words): Capitalize all when option is true
Browse files Browse the repository at this point in the history
  • Loading branch information
justinvdm committed May 6, 2020
1 parent 59e8063 commit b64ec17
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sentence.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function sentence(input, opts) {
id = hash([id, 'sentence', i])

var firstOpts = conj(opts, {
capitalize: true,
capitalize: 'first',
min: minWords,
max: maxWords,
unicode: unicode
Expand Down
6 changes: 3 additions & 3 deletions words.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ var word = require('./word')
var DEFAULT_MIN_SYLLABLES = 1
var DEFAULT_MIN_WORDS = 2
var DEFAULT_MAX_WORDS = 3
var DEFAULT_CAPITALIZE = true
var DEFAULT_CAPITALIZE = 'first'

function words(input, opts) {
opts = opts || 0
var minSyllables = defaults(opts.minSyllables, DEFAULT_MIN_SYLLABLES)
var capitalize = defaults(opts.capitalize, DEFAULT_CAPITALIZE)
var shouldCapitalizeFirst = capitalize || capitalize === 'first'
var shouldCapitalizeAll = capitalize === 'all'
var shouldCapitalizeAll = capitalize === true || capitalize === 'all'
var shouldCapitalizeFirst = shouldCapitalizeAll || capitalize === 'first'
var min = defaults(opts.min, DEFAULT_MIN_WORDS)
var max = defaults(opts.max, DEFAULT_MAX_WORDS)

Expand Down

0 comments on commit b64ec17

Please sign in to comment.