@abaplint/runtime
Version:
Transpiler - Runtime
30 lines • 914 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.from_mixed = from_mixed;
const throw_error_1 = require("../throw_error");
const types_1 = require("../types");
function from_mixed(input) {
let sep = input.sep;
if (sep === undefined) {
sep = "_";
}
if (typeof sep !== "string") {
sep = sep.get();
}
if (sep.length === 0) {
(0, throw_error_1.throwError)("CX_SY_STRG_PAR_VAL");
}
const min = 1;
if (min < 0) {
(0, throw_error_1.throwError)("CX_SY_STRG_PAR_VAL");
}
let val = input.val;
if (typeof val !== "string") {
val = val.get();
}
// todo: handle "case" and "min" ?
const regex = new RegExp(/([A-Z])/, "g");
val = val.substring(0, 1) + val.substring(1).replace(regex, "_$1");
return new types_1.String().set(val.toUpperCase());
}
//# sourceMappingURL=from_mixed.js.map