diff --git a/lib/index.js b/lib/index.js index 4531cdd..88aeb09 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,4 +1,5 @@ var http = require('http'); +var querystring = require('querystring'); module.exports.nicify = function(js, options, callback) { if (typeof options === 'function') { @@ -7,10 +8,16 @@ module.exports.nicify = function(js, options, callback) { } options = options || {}; + var query = { + pretty: (options.pretty === undefined)? 1 : (options.pretty)? 1 : 0, + rename: (options.rename === undefined)? 1 : (options.rename)? 1 : 0, + types: (options.types === undefined)? 1 : (options.types)? 1 : 0, + suggest: (options.suggest === undefined)? 1 : (options.suggest)? 1 : 0, + }; var reqOptions = { hostname: 'www.jsnice.org', - path: '/beautify?pretty=1&rename=1&types=1&suggest=0', + path: '/beautify?' + querystring.stringify(query), port: 80, method: 'POST', };