@gatling.io/core
Version:
Gatling JS is a JavaScript/TypeScript interface for the [Gatling load testing tool](https://gatling.io/).
33 lines (32 loc) • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.repeatImpl = void 0;
const session_1 = require("../session");
const on_1 = require("./on");
const repeatImpl = (jvmRepeat, wrap) => (times, counterName) => {
if (counterName !== undefined) {
// repeat(times, counterName
if (typeof times === "number") {
return (0, on_1.wrapOn)(jvmRepeat.repeat(times, counterName), wrap);
}
else if (typeof times === "string") {
return (0, on_1.wrapOn)(jvmRepeat.repeat(times, counterName), wrap);
}
else {
return (0, on_1.wrapOn)(jvmRepeat.repeat((0, session_1.underlyingSessionTo)(times), counterName), wrap);
}
}
else {
// repeat(times)
if (typeof times === "number") {
return (0, on_1.wrapOn)(jvmRepeat.repeat(times), wrap);
}
else if (typeof times === "string") {
return (0, on_1.wrapOn)(jvmRepeat.repeat(times), wrap);
}
else {
return (0, on_1.wrapOn)(jvmRepeat.repeat((0, session_1.underlyingSessionTo)(times)), wrap);
}
}
};
exports.repeatImpl = repeatImpl;