regexper-static/src/js/parser/javascript/repeat.js

36 lines
520 B
JavaScript
Raw Normal View History

export default {
minimum() {
return this._spec.minimum();
},
maximum() {
return this._spec.maximum();
},
greedy() {
return (this._greedy.textValue !== '');
},
2014-12-09 23:08:40 +00:00
hasSkip() {
return this.minimum() === 0;
},
2014-12-09 23:08:40 +00:00
hasLoop() {
return this.maximum() === -1 || this.maximum() > 1;
},
2014-12-09 23:08:40 +00:00
contentPosition() {
var x = 0, y = 0;
2014-12-09 23:08:40 +00:00
if (this.hasSkip()) {
y = 10;
}
2014-12-09 23:08:40 +00:00
if (this.hasSkip() || this.hasLoop()) {
x = 15;
}
return Snap.matrix().translate(x, y);
}
}