summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/node_modules/remark-parse/lib/util/interrupt.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/eslint/node_modules/remark-parse/lib/util/interrupt.js')
-rw-r--r--tools/node_modules/eslint/node_modules/remark-parse/lib/util/interrupt.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/tools/node_modules/eslint/node_modules/remark-parse/lib/util/interrupt.js b/tools/node_modules/eslint/node_modules/remark-parse/lib/util/interrupt.js
new file mode 100644
index 0000000000..b8dc230550
--- /dev/null
+++ b/tools/node_modules/eslint/node_modules/remark-parse/lib/util/interrupt.js
@@ -0,0 +1,51 @@
+/**
+ * @author Titus Wormer
+ * @copyright 2015 Titus Wormer
+ * @license MIT
+ * @module remark:parse:util:get-indentation
+ * @fileoverview Get indentation.
+ */
+
+'use strict';
+
+module.exports = interrupt;
+
+function interrupt(interruptors, tokenizers, ctx, params) {
+ var bools = ['pedantic', 'commonmark'];
+ var count = bools.length;
+ var length = interruptors.length;
+ var index = -1;
+ var interruptor;
+ var config;
+ var fn;
+ var offset;
+ var bool;
+ var ignore;
+
+ while (++index < length) {
+ interruptor = interruptors[index];
+ config = interruptor[1] || {};
+ fn = interruptor[0];
+ offset = -1;
+ ignore = false;
+
+ while (++offset < count) {
+ bool = bools[offset];
+
+ if (config[bool] !== undefined && config[bool] !== ctx.options[bool]) {
+ ignore = true;
+ break;
+ }
+ }
+
+ if (ignore) {
+ continue;
+ }
+
+ if (tokenizers[fn].apply(ctx, params)) {
+ return true;
+ }
+ }
+
+ return false;
+}