Skip to content

Commit

Permalink
feat(window): Add fallback to duckduckgo search
Browse files Browse the repository at this point in the history
  • Loading branch information
unai.esteibar authored and uesteibar committed Apr 16, 2017
1 parent 46e3f6e commit d24a7e4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/helpers/urls.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { urls } from '../constants'

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

_fallback = command => {
return `https://duckduckgo.com/?q=${command}+documentation&t=h_&ia=web`
};
}

export default (new Urls)
export default new Urls()

0 comments on commit d24a7e4

Please sign in to comment.