aboutsummaryrefslogtreecommitdiff
path: root/lib/document-matchers.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-05-03 21:27:00 +0100
committerMichael Williamson <mike@zwobble.org>2013-05-03 21:27:00 +0100
commitce01e3ec266ca3cbd96832766174e49337db98f8 (patch)
tree60a6bec29909354bd95ecac7319f94f9bbde1d1e /lib/document-matchers.js
parent23438dd97f93b86115cc4196c88d12e5168acbd5 (diff)
Replace paragraphStyleMap with more general styleMap
Diffstat (limited to 'lib/document-matchers.js')
-rw-r--r--lib/document-matchers.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/document-matchers.js b/lib/document-matchers.js
new file mode 100644
index 0000000..6a35b51
--- /dev/null
+++ b/lib/document-matchers.js
@@ -0,0 +1,17 @@
+exports.paragraph = paragraph;
+exports.run = run;
+
+
+function paragraph(styleName) {
+ return matcher("paragraph", styleName);
+}
+
+function run(styleName) {
+ return matcher("run", styleName);
+}
+
+function matcher(elementType, styleName) {
+ return function(element) {
+ return element.type === elementType && element.styleName === styleName;
+ };
+}