From b95c058b0c4c8cddfc008978dca62a610997d511 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Tue, 3 Jun 2014 10:34:23 -0400 Subject: [PATCH] actually use options --- lib/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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', };