How to use the unist-util-visit-parents.CONTINUE function in unist-util-visit-parents

To help you get started, we’ve selected a few unist-util-visit-parents examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aliyun / alibabacloud-console-components / packages / gatsby-theme-console-doc / src / buildtime / remarkPlugins / linkInstructions / remarkPlugin.ts View on Github external
inst.instructionHandler({
                  node,
                  ancestors,
                  instructionParam: inst.instructionParam,
                  linkURL,
                  file,
                })
              ).then(() => res(true))
              // stop traversal because the instruction may change ast.
              // the ast may be **completly different** after this instruction's execution.
              // we will detect next instruction in the **next transform pass**.
              return visit.EXIT
            }
          }
        }
        return visit.CONTINUE
      })
      if (!foundLinkInstruction) res(false) // didn't find any instruction
github syntax-tree / unist-util-visit / index.js View on Github external
'use strict'

module.exports = visit

var visitParents = require('unist-util-visit-parents')

var CONTINUE = visitParents.CONTINUE
var SKIP = visitParents.SKIP
var EXIT = visitParents.EXIT

visit.CONTINUE = CONTINUE
visit.SKIP = SKIP
visit.EXIT = EXIT

function visit(tree, test, visitor, reverse) {
  if (typeof test === 'function' && typeof visitor !== 'function') {
    reverse = visitor
    visitor = test
    test = null
  }

  visitParents(tree, test, overload, reverse)

unist-util-visit-parents

unist utility to recursively walk over nodes, with ancestral information

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis