carcass-auth
Version:
(Node.js) Authentication middlewares, in Carcass style.
14 lines (12 loc) • 346 B
text/coffeescript
qs = require('qs')
###*
* Just a helper.
*
* {String} the URL with the val appended.
###
module.exports = appendQS = (url, val) ->
return if not url?
return url if not val?
val = qs.stringify(val) if typeof val isnt 'string'
return url if not val.length
return url + (if ~url.indexOf('?') then '&' else '?') + val