email-dns-tools/assets/scripts/fields/ConstantField.js
2026-01-14 10:39:19 +01:00

14 lines
327 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}"`)
}
}