From abcdc7a5c4b66a4fc5d7f7f605e2d64d44767bf1 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sat, 4 May 2013 10:59:50 +0100 Subject: Add list method to document matcher --- lib/document-matchers.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/document-matchers.js') 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 && -- cgit v1.2.3