Permalink
Browse files

Added support for output in formats other than JSON.

  • Loading branch information...
1 parent dad539e commit 1a65a61580e8ea4311544f6efaad7d664dfc9d45 @mcantelon committed Dec 31, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/calais.js
View
@@ -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

0 comments on commit 1a65a61

Please sign in to comment.