Skip to content

Commit

Permalink
fix(input_decoding): Decide to show or not depending on found command
Browse files Browse the repository at this point in the history
  • Loading branch information
uesteibar committed Apr 16, 2017
1 parent 7885141 commit 18d6e4c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/helpers/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { urls } from '../constants'

class Urls {
url = command => {
const cleanCommand = command.replace(/[^0-9a-z]/gi, '')
return urls[cleanCommand] || this._fallback(cleanCommand)
return urls[command] || this._fallback(command)
};

_fallback = command => {
Expand Down
16 changes: 8 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ const types = {
exports.reduceUI = (state, action) => {
switch (action.type) {
case types.TOGGLE:
const hyperdocs = state.hyperdocs === undefined ||
state.hyperdocs.show === undefined
? { show: true }
: !state.hyperdocs.show
return state.set('hyperdocs', {
show: hyperdocs.show,
command: action.command,
})
const command = action.command &&
action.command.replace(/[^0-9a-z]/gi, '')
const hyperdocs = {
show: !!command,
command,
}

return state.set('hyperdocs', hyperdocs)
}
return state
}
Expand Down

0 comments on commit 18d6e4c

Please sign in to comment.