email-dns-tools/assets/scripts/fields/ConstantField.js
2026-01-14 13:55:59 +01:00

18 lines
371 B
JavaScript

import { Field } from "./Field.js";
import { ValidationError } from "../ValidationError.js";
export class ConstantField extends Field {
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;
}
}