Skip to content

Commit

Permalink
Patches hasty conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoferjoseph committed Nov 17, 2017
1 parent f65c6ef commit 1710426
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ module.exports = function hashswitch (actions, defaultCallback){
var hash = {}
hash.DEFAULT_CALLBACK = defaultCallback || function () {}
actions && Object.keys(actions).forEach(function (action) {
(('string' === typeof action || 'number' !== typeof action) && 'function' === typeof actions[action]) ?
(('string' === typeof action || 'number' === typeof action) && 'function' === typeof actions[action]) ?
(hash[action] = actions[action]) :
console.error(action + ' should be a string or number and ' + actions[action] + ' should be a function.')
})
return function exectue (action) {
('string' !== typeof action || 'number' !== typeof action) && console.error(action + ' should be a string or number')
!('string' === typeof action || 'number' === typeof action) && console.error(action + ' should be a string or number')
return (hash[action] || hash.DEFAULT_CALLBACK).apply(this, [].slice.call(arguments, 1))
}
}

0 comments on commit 1710426

Please sign in to comment.