This repository has been archived on 2020-11-02. You can view files and clone it, but cannot push or open issues or pull requests.
2020-11-01 22:46:04 +00:00

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
}