Skip to content

Commit

Permalink
display "negative" rather than "minus"
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Mar 28, 2017
1 parent 06962e0 commit 3e761ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Expand Up @@ -132,13 +132,13 @@ function reducer(previous, {number, word}) {
}

module.exports = number => {
let minus = false
let negative = false
if (isNaN(number)) return 'not a number'
if (!number) return 'zero'
if (number < 0) {
minus = true
negative = true
number = Math.abs(number)
}
const result = deconstruct(number).reduce(reducer, '').trim()
return minus ? `minus ${result}` : result
return negative ? `negative ${result}` : result
}

0 comments on commit 3e761ef

Please sign in to comment.