email-dns-tools/assets/scripts/fields/ConstantField.js
2026-01-14 15:46:37 +01:00

20 lines
390 B
JavaScript

import { Field } from "./Field.js";
import { ValidationError } from "../ValidationError.js";
export class ConstantField extends Field {
separator = "=";
constructor(key, value) {
super(key);
this.value = value;
}
validate(value) {
if (this.value !== value) throw new ValidationError(`Field ${this.key} must be "${this.value}"`)
}
getInputValue() {
return this.value;
}
}