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.
14 lines • 406 B
JavaScript
export function cut(text, splitter, n, limit) {
if (typeof text === "string") {
const a = text
.split(splitter, limit)
.map(value => value.trim())
.filter(value => value.length > 0);
const i = n >= 0 ? n : a.length + n;
return i >= 0 && i < a.length ? a[i] : null;
}
else {
return null;
}
}
//# sourceMappingURL=cut.js.map