diff options
| author | Michael Williamson <mike@zwobble.org> | 2013-05-04 10:59:50 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2013-05-04 10:59:50 +0100 |
| commit | abcdc7a5c4b66a4fc5d7f7f605e2d64d44767bf1 (patch) | |
| tree | aa8bdfcbeec32387f3e83fdf272865c7f4818218 /lib/document-matchers.js | |
| parent | a78d8242d2be4377accfb95447d549828f08dbd0 (diff) | |
Add list method to document matcher
Diffstat (limited to 'lib/document-matchers.js')
| -rw-r--r-- | lib/document-matchers.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/document-matchers.js b/lib/document-matchers.js index 820d6c2..58b3204 100644 --- a/lib/document-matchers.js +++ b/lib/document-matchers.js @@ -22,17 +22,19 @@ Matcher.prototype.matches = function(element) { } Matcher.prototype.orderedList = function(levelIndex) { - this._listIndex = levelIndex; - this._listIsOrdered = true; - return this; + return this.list({isOrdered: true, levelIndex: levelIndex}); } Matcher.prototype.unorderedList = function(levelIndex) { - this._listIndex = levelIndex; - this._listIsOrdered = false; - return this; + return this.list({isOrdered: false, levelIndex: levelIndex}); } +Matcher.prototype.list = function(options) { + this._listIndex = options.levelIndex; + this._listIsOrdered = options.isOrdered; + return this; +}; + function isList(element, levelIndex, isOrdered) { return element.numbering && element.numbering.level == levelIndex && |
