remove unused code in node_helper
E3V3A opened this issue · 0 comments
E3V3A commented
Remove the following unused code from node_helper.js
:
// To check if something is JSON
function isJSON(str) {
try { return (JSON.parse(str) && !!str); }
catch (e) { return false; }
}
// To check if something is an Array or Object (parsed JSON)
function isAO(val) {
return val instanceof Array || val instanceof Object ? true : false;
}
// --------------------------------------------------------------------------
// What: A dirt simple JSON cleanup function that also compactifies the data
// NOTE: - Only use on flat and trustworthy ASCII JSON data!
// - Cannot handle any characters outside [A-Za-z0-9_\-]. (e.g. UTF-8)
// - Using remote data without further sanitation is a security risk!
// --------------------------------------------------------------------------
const re1 = /([A-Za-z0-9_\-]+):/gm; // use const to make sure it is compiled
function jZen(juice) {
//let re1 = /([A-Za-z0-9_\-]+):/gm; // Find all ASCII words $1 before an ":"
//let data = juice;
let str = "";
str = juice.replace(/\s/gm, ''); // Remove all white-space
str = str.replace(/\'/gm, '\"'); // Replace all ' with "
str = str.replace(re1, '\"$1\":'); // Replace $1: with "$1":
//console.log("Dirty JSON is:\n" + data.toString() );
//console.log("Clean JSON is:\n" + str);
return str;
}