Skip to content

Commit

Permalink
Added support for output in formats other than JSON.
Browse files Browse the repository at this point in the history
  • Loading branch information
mcantelon committed Dec 31, 2010
1 parent dad539e commit 1a65a61
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/calais.js
Expand Up @@ -106,9 +106,13 @@ Calais.prototype = {
response.on('end', function() {

var urldata = scope._parseChunks(data)
var result = JSON.parse(urldata)
var jsonOutput = (calais.options.outputFormat == 'application/json')

result = (calais.options.cleanResult)
var result = (jsonOutput)
? JSON.parse(urldata)
: urldata

result = (jsonOutput && calais.options.cleanResult)
? calais.clean_result(result)
: result

Expand Down

0 comments on commit 1a65a61

Please sign in to comment.