interrupt.js 655 B

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict'
  2. module.exports = interrupt
  3. function interrupt(interruptors, tokenizers, ctx, parameters) {
  4. var length = interruptors.length
  5. var index = -1
  6. var interruptor
  7. var config
  8. while (++index < length) {
  9. interruptor = interruptors[index]
  10. config = interruptor[1] || {}
  11. if (
  12. config.pedantic !== undefined &&
  13. config.pedantic !== ctx.options.pedantic
  14. ) {
  15. continue
  16. }
  17. if (
  18. config.commonmark !== undefined &&
  19. config.commonmark !== ctx.options.commonmark
  20. ) {
  21. continue
  22. }
  23. if (tokenizers[interruptor[0]].apply(ctx, parameters)) {
  24. return true
  25. }
  26. }
  27. return false
  28. }