From a964dc1bb4b74dc98f8b95f7734d912682e9c0ed Mon Sep 17 00:00:00 2001 From: JoshuaCWebDeveloper Date: Wed, 30 Nov 2016 12:46:31 -0800 Subject: [PATCH] Create functions instead of extending String prototype --- js/xepOnline.jqPlugin.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/xepOnline.jqPlugin.js b/js/xepOnline.jqPlugin.js index e83d785..b1920ab 100644 --- a/js/xepOnline.jqPlugin.js +++ b/js/xepOnline.jqPlugin.js @@ -1,9 +1,9 @@ -String.prototype.toCamel = function(){ - return this.replace(/(\-[a-z])/g, function($1){return $1.toUpperCase().replace('-','');}); +var convertToCamel = function(str){ + return str.replace(/(\-[a-z])/g, function($1){return $1.toUpperCase().replace('-','');}); }; -String.prototype.fromCamel = function(){ - return this.replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}); +var convertFromCamel = function(){ + return str.replace(/([A-Z])/g, function($1){return "-"+$1.toLowerCase();}); }; var xepOnline = window.xepOnline || {}; @@ -603,14 +603,14 @@ xepOnline.Formatter = { if(options && options.cssStyle) { jQuery.each(options.cssStyle, function(key, value) { jQuery.each(value, function(objkey, objvalue) { - stylebuilder += objkey.fromCamel()+ ': ' + objvalue + '; '; + stylebuilder += convertFromCamel(objkey)+ ': ' + objvalue + '; '; }); }); } if(options && options.foStyle) { jQuery.each(options.foStyle, function(key, value) { jQuery.each(value, function(objkey, objvalue) { - fostylebuilder += objkey.fromCamel()+ ': ' + objvalue + '; '; + fostylebuilder += convertFromCamel(objkey)+ ': ' + objvalue + '; '; }); }); }