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.

25 lines 931 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatStringValue = void 0; var combineUrl_js_1 = require("./combineUrl.js"); var collapseWhitespace_js_1 = require("./collapseWhitespace.js"); var is_js_1 = require("./is.js"); function formatStringValue(value, format, origin) { if (format === "href" && typeof value === "string" && origin && !(0, is_js_1.isAbsoluteUrl)(value)) { return (0, combineUrl_js_1.combineUrl)(origin, value); } else if (format === "multiline") { return (0, collapseWhitespace_js_1.collapseWhitespace)(value, true); } else if (format === "singleline") { return (0, collapseWhitespace_js_1.collapseWhitespace)(value, false); } else if (format === "none") { return value; } else { return value; } } exports.formatStringValue = formatStringValue; //# sourceMappingURL=formatStringValue.js.map