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.

19 lines 607 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatHTML = void 0; 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(function (obj) { return typeof obj === "string"; })) { return value.map(function (obj) { return formatHTML(obj); }); } else { return value; } } exports.formatHTML = formatHTML; //# sourceMappingURL=formatHTML.js.map