Commit db0b75c8 authored by Mark Stenglein's avatar Mark Stenglein
Browse files

DelegatorsParam: Setter: Refactor delegators

This commit refactors the setter in DelegatorsParam so that it uses a
more understandable code style.

Replacing the foreach with a single if statement which uses Array.every,
and then using as well as a prepared string to make the
paramValues for the generator function.
Reported-by: Akshay Karthik's avatarAkshay Karthik <>
Signed-off-by: Mark Stenglein's avatarMark Stenglein <>
parent 4a82e831
Pipeline #1173 passed with stages
in 54 seconds
......@@ -90,21 +90,13 @@ export default class DelegatorsParam extends Parameter {
* @author Mark Stenglein <>
set delegators(newDelegators: string[]) {
// Empty array to build the parent paramValues from newDelegators
const paramValues: string[] = [];
* Checks to make sure that each individual Delegator
* consists only of QSafeChars before wrapping it in DQUOTEs
* and adding the `mailto:`
newDelegators.forEach((newDelegator: string) => {
if (!Parameter.isQSafeChar(newDelegator)) {
// Ensure each delegator is valid QSafeChar String
if (!newDelegators.every(Parameter.isQSafeChar))
throw new TypeError("Delegator must be QSafeChars");
} else {
paramValues.push("\"mailto:" + newDelegator + "\"");
// Construct paramValues for generation
const paramValues: string[] =
delegator => `"mailto:${delegator}"`);
// Passes the built paramValues to the Parent class
this.paramValues = paramValues;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment