36 lines
655 B
JavaScript
36 lines
655 B
JavaScript
'use strict'
|
|
|
|
module.exports = interrupt
|
|
|
|
function interrupt(interruptors, tokenizers, ctx, parameters) {
|
|
var length = interruptors.length
|
|
var index = -1
|
|
var interruptor
|
|
var config
|
|
|
|
while (++index < length) {
|
|
interruptor = interruptors[index]
|
|
config = interruptor[1] || {}
|
|
|
|
if (
|
|
config.pedantic !== undefined &&
|
|
config.pedantic !== ctx.options.pedantic
|
|
) {
|
|
continue
|
|
}
|
|
|
|
if (
|
|
config.commonmark !== undefined &&
|
|
config.commonmark !== ctx.options.commonmark
|
|
) {
|
|
continue
|
|
}
|
|
|
|
if (tokenizers[interruptor[0]].apply(ctx, parameters)) {
|
|
return true
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|