aboutsummaryrefslogtreecommitdiff
path: root/lib/document-matchers.js
blob: 3232a2398445df50b185f2ea03e952e6b6fb2b7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
exports.paragraph = paragraph;
exports.run = run;


function paragraph(styleName) {
    return new Matcher("paragraph", styleName);
}

function run(styleName) {
    return new Matcher("run", styleName);
}

function Matcher(elementType, styleName) {
    this.elementType = elementType;
    this.styleName = styleName;
}

Matcher.prototype.matches = function(element) {
    return element.type === this.elementType && element.styleName === this.styleName;
}