@fontoxml/fontoxml-development-tools
Version:
Development tools for Fonto.
35 lines (28 loc) • 722 B
JavaScript
import symbols from './symbols.js';
import VariableSyntaxPart from './VariableSyntaxPart.js';
export default class Parameter extends VariableSyntaxPart {
constructor(name) {
super(name);
}
[symbols.isMatchForPart](value) {
return value === '-' || value.substr(0, 1) !== '-';
}
[symbols.updateTiersAfterMatch](tiers) {
tiers.ordered.shift();
return tiers;
}
[symbols.spliceInputFromParts](parts, _tiers) {
const value = parts.shift();
return value === '-' ? undefined : value;
}
[symbols.createContributionToRequestObject](_accumulated, value) {
return {
parameters: {
[this.name]: value === undefined ? this.cloneDefault() : value,
},
};
}
getType() {
return 'parameter';
}
}