UNPKG

syphonx-core

Version:

SyphonX is a template-driven solution for extracting data from HTML in a highly efficient way. It combines the power of jQuery, Regular Expressions, and Javascript into a declarative template-driven format that extracts and reshapes HTML data into JSON.

15 lines 435 B
export function formatHTML(value) { if (typeof value === "string") { return value .replace(/(<[a-z0-9:._-]+>)[ ]*/gi, "$1") .replace(/[ ]*<\//g, "</") .trim(); } else if (value instanceof Array && value.every(obj => typeof obj === "string")) { return value.map(obj => formatHTML(obj)); } else { return value; } } //# sourceMappingURL=formatHTML.js.map