26 lines
556 B
JavaScript
26 lines
556 B
JavaScript
import { Term } from "./Term.js";
|
|
import { ValidationError } from "../ValidationError.js";
|
|
import { validateSpfDomain } from "./utils.js";
|
|
|
|
export class Modifier extends Term {
|
|
separator = "=";
|
|
|
|
constructor(key) {
|
|
super(key);
|
|
}
|
|
|
|
validate(value) {
|
|
if (!validateSpfDomain(value)) throw new ValidationError(`Value for "${this.key}" is not a valid domain name`);
|
|
|
|
return true;
|
|
}
|
|
|
|
getInputValue() {
|
|
return document.getElementById(this.id).value;
|
|
}
|
|
|
|
getInputHtml() {
|
|
return `<input id="${this.id}" type="text" placeholder="example.com">`;
|
|
}
|
|
}
|