diff options
author | Christopher Lenz <cmlenz@apache.org> | 2009-01-14 13:41:32 +0000 |
---|---|---|
committer | Christopher Lenz <cmlenz@apache.org> | 2009-01-14 13:41:32 +0000 |
commit | 75ab4ae3e4a423c0f85cd87a2237453fd43bfba8 (patch) | |
tree | 2bb07fcfb9a9458cd998b38598ae726c3c2d22fc /share/www/script/futon.format.js | |
parent | 54986fe78df83e75b369c5a0c3049f36f96f1ba1 (diff) |
Refactor the inline editing Javascript code in Futon to make it reusable.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@734390 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/futon.format.js')
-rw-r--r-- | share/www/script/futon.format.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/share/www/script/futon.format.js b/share/www/script/futon.format.js index b8870a94..028119ed 100644 --- a/share/www/script/futon.format.js +++ b/share/www/script/futon.format.js @@ -16,13 +16,11 @@ // JSON pretty printing formatJSON: function(val, options) { - options = options || {}; - if (options.indent === undefined) { - options.indent = 4; - } - options.indent = options.indent !== undefined ? options.indent : 4; - options.linesep = options.linesep !== undefined ? options.linesep : "\n"; - options.quoteKeys = options.quoteKeys !== undefined ? options.quoteKeys : true; + options = $.extend({ + indent: 4, + linesep: "\n", + quoteKeys: true + }, options || {}); var itemsep = options.linesep.length ? "," + options.linesep : ", "; function escape(string) { |