This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(value) { | |
// First we need to find which quote character to use by comparing the | |
// number of times each occurs in the string. | |
var quotes_dbl = (value.match(/"/g) || []).length; | |
var quotes_sgl = (value.match(/'/g) || []).length; | |
var quote = quotes_sgl <= quotes_dbl ? "'" : '"'; | |
var quote_code = quote.charCodeAt(0); | |
NewerOlder