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.
36 lines • 1.18 kB
JavaScript
export function isAbsoluteUrl(url) {
return url.startsWith("http://") || url.startsWith("https://");
}
export function isEmpty(obj) {
if (obj === undefined || obj === null) {
return true;
}
else if (obj instanceof Array) {
return obj.length === 0;
}
else if (typeof obj === "string") {
return obj.length === 0;
}
else {
return false;
}
}
export function isFormula(value) {
return typeof value === "string" && value.startsWith("{") && value.endsWith("}");
}
export function isRegexp(value) {
return typeof value === "string" && (value.startsWith("/") || value.startsWith("!/"));
}
export function isInvocableFrom(obj, method) {
return obj !== null && typeof obj === "object" && typeof obj[method] === "function";
}
export function isJQueryObject(obj) {
return typeof obj === "object" && obj !== null && (!!obj.jquery || !!obj.cheerio);
}
export function isObject(obj) {
return typeof obj === "object" && obj !== null && !(obj instanceof Array) && !(obj instanceof Date);
}
export function isNullOrUndefined(obj) {
return obj === null || obj === undefined;
}
//# sourceMappingURL=is.js.map