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.
21 lines • 685 B
JavaScript
import { combineUrl } from "./combineUrl.js";
import { collapseWhitespace } from "./collapseWhitespace.js";
import { isAbsoluteUrl } from "./is.js";
export function formatStringValue(value, format, origin) {
if (format === "href" && typeof value === "string" && origin && !isAbsoluteUrl(value)) {
return combineUrl(origin, value);
}
else if (format === "multiline") {
return collapseWhitespace(value, true);
}
else if (format === "singleline") {
return collapseWhitespace(value, false);
}
else if (format === "none") {
return value;
}
else {
return value;
}
}
//# sourceMappingURL=formatStringValue.js.map