Every line of 'foreach json jquery' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
192 function evalJSON(sanitize) { 193 var json = this.unfilterJSON(), 194 cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; 195 if (cx.test(json)) { 196 json = json.replace(cx, function (a) { 197 return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); 198 }); 199 } 200 try { 201 if (!sanitize || json.isJSON()) return eval('(' + json + ')'); 202 } catch (e) { } 203 throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); 204 }
134 function jsonParser(json) { 135 // Number fo indentation 136 n = 2; 137 // Start the loop 138 json.forEach(function(root){ 139 root.child.forEach(function(child){ 140 // If line doesn't have HB tag 141 if(root.tags.length < 1){ 142 child.indent = root.indent+n; 143 } 144 // If line has HB tag and start with HB tag and not comment 145 else if(root.tags.length > 0 && root.tags[0].position == 0 && !root.content.match(/^\/\/\-*.*/)) { 146 child.indent = root.indent; 147 } 148 else if(root.tags.length > 0 && root.tags[0].position != 0 && !root.content.match(/^\/\/\-*.*/)) { 149 child.indent = root.indent+n; 150 } 151 // If child has child, recursive call 152 if(child.child.length > 0) 153 jsonParser([child]); 154 }); 155 }); 156 return json; 157 }