UNPKG

361 Btext/coffeescriptView Raw
1querystring = require 'querystring'
2log = require 'bog'
3
4asInt = (s) ->
5 return undefined unless s
6 try
7 n = parseInt(s, 10)
8 throw Error('nan') if isNaN(n)
9 n
10 catch ex
11 log.warn "Failed to interpret as int: #{s}"
12 undefined
13
14module.exports = (str) ->
15
16 p = querystring.parse str
17
18 {
19 q: p.q ? ''
20 }