From 75ab4ae3e4a423c0f85cd87a2237453fd43bfba8 Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Wed, 14 Jan 2009 13:41:32 +0000 Subject: 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 --- share/www/script/futon.format.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'share/www/script/futon.format.js') 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) { -- cgit v1.2.3