From bb532b7c70c52c2b0808dda1742e5d1fa92742c3 Mon Sep 17 00:00:00 2001 From: Alven Diaz Date: Mon, 20 Mar 2017 16:08:43 -0500 Subject: [PATCH] Added format option --- lib/opencnam.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/opencnam.js b/lib/opencnam.js index 3dfe9d0..7448214 100644 --- a/lib/opencnam.js +++ b/lib/opencnam.js @@ -36,7 +36,13 @@ exports.lookup = function(phone_number, options, callback) { return callback(new Error('phone_number must be 10 digits.')); } - var uri = OPENCNAM_API_URI + phone_number + '?format=text'; + var format = 'format=text'; + + if (options.format) { + format = 'format=' + options.format; + } + + var uri = OPENCNAM_API_URI + phone_number + '?' + format; if (options.account_sid) { uri += '&account_sid=' + encodeURIComponent(options.account_sid);