26 lines
550 B
JavaScript
26 lines
550 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(id) {
|
|
return document.getElementById(id).value;
|
|
}
|
|
|
|
getInputHtml(id) {
|
|
return `<input id="${id}" type="text" placeholder="example.com">`;
|
|
}
|
|
}
|