From f156e46c6888ab32c5ee166c4ba75fbe2c9487bf Mon Sep 17 00:00:00 2001 From: John Papa Date: Tue, 15 May 2012 14:43:53 -0300 Subject: [PATCH] Added optional parameter for turning off console.log --- js/jquery.mockjson.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/js/jquery.mockjson.js b/js/jquery.mockjson.js index db52ad9..6f1dac7 100644 --- a/js/jquery.mockjson.js +++ b/js/jquery.mockjson.js @@ -19,7 +19,7 @@ $.mockJSON = function(request, template) { }; $.mockJSON.random = true; - +$.mockJSON.log = true; var _original_ajax = $.ajax; $.ajax = function(options) { @@ -115,8 +115,10 @@ function getRandomData(key) { var params = key.match(/\(([^\)]+)\)/g) || []; if (!(key in $.mockJSON.data)) { - console.log(key); - console.log(params); + if ($.mockJSON.log) { + console.log(key); + console.log(params); + } return key; }