22 lines
404 B
JavaScript
22 lines
404 B
JavaScript
import { Term } from "./Term.js";
|
|
import { ValidationError } from "../ValidationError.js";
|
|
|
|
export class VersionTerm extends Term {
|
|
separator = "=";
|
|
|
|
constructor(key, version) {
|
|
super(key);
|
|
this.version = version;
|
|
}
|
|
|
|
validate(value) {
|
|
if (value !== this.version) throw new ValidationError(`Version must be "${this.version}"`);
|
|
|
|
return true;
|
|
}
|
|
|
|
getInputValue() {
|
|
return this.version;
|
|
}
|
|
}
|