@abaplint/runtime
Version:
Transpiler - Runtime
27 lines • 873 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.contains = contains;
const types_1 = require("../types");
function contains(input) {
if (input.case !== undefined
|| input.off !== undefined
|| input.len !== undefined
|| input.occ !== undefined) {
throw "runtime, contains() todo";
}
let ret = " ";
if (input.regex) {
ret = input.val.get().match(input.regex.get()) !== null ? "X" : " ";
}
else if (input.sub) {
ret = input.val.get().includes(input.sub.get()) ? "X" : " ";
}
else if (input.start) {
ret = input.val.get().startsWith(input.start.get()) ? "X" : " ";
}
else if (input.end) {
ret = input.val.get().endsWith(input.end.get()) ? "X" : " ";
}
return new types_1.String().set(ret);
}
//# sourceMappingURL=contains.js.map