How to use the unist-util-visit.SKIP function in unist-util-visit

To help you get started, we’ve selected a few unist-util-visit 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 retextjs / retext-readability / index.js View on Github external
character: letters,
          letter: letters
        }

        report(file, sentence, threshold, targetAge, [
          gradeToAge(daleChallFormula.gradeLevel(daleChallFormula(counts))[1]),
          gradeToAge(ari(counts)),
          gradeToAge(colemanLiau(counts)),
          fleschToAge(flesch(counts)),
          smogToAge(smog(counts)),
          gradeToAge(gunningFog(counts)),
          gradeToAge(spacheFormula(counts))
        ])
      }

      return visit.SKIP

      function visitor(node) {
        var value = toString(node)
        var syllables = syllable(value)

        wordCount++
        totalSyllables += syllables
        letters += value.length
        caseless = value.toLowerCase()

        // Count complex words for gunning-fog based on whether they have three
        // or more syllables and whether they aren’t proper nouns.  The last is
        // checked a little simple, so this index might be over-eager.
        if (syllables >= 3) {
          polysillabicWord++
github retextjs / retext-pos / index.js View on Github external
}
    }

    // Apply tags if there are words.
    if (values.length !== 0) {
      tags = tagger.tag(values)
      length = tags.length
      index = -1

      while (++index < length) {
        patch(words[index], tags[index][1])
      }
    }

    // Don’t enter sentences.
    return visit.SKIP
  }
github retextjs / retext-equality / lib / factory.js View on Github external
search(node, normalize, handle)
        search(node, noNormalize, handle, true)

        // Ignore or emit offending words based on their pattern.
        for (key in matches) {
          type = byId[key].type

          if (type === 'or' && noBinary) {
            type = 'simple'
          }

          handlers[type](matches[key], byId[key], file)
        }

        return visit.SKIP

        // Handle a match.
        function handle(match, position, parent, phrase) {
          var index = list.indexOf(phrase)
          var pattern = byIndex[index]
          var id = pattern.id

          if (phrase !== phrase.toLowerCase() && toString(match) !== phrase) {
            return
          }

          if (!(id in matches)) {
            matches[id] = []
          }

          matches[id].push({
github remarkjs / remark-lint / packages / remark-lint-no-paragraph-content-indent / index.js View on Github external
function visitor(node) {
    var first = true

    visit(node, check)

    return visit.SKIP

    function check(node, pos, parent) {
      var start = position.start(node)
      var value
      var index
      var line
      var cumulative
      var indent

      if (!applicable(node)) {
        return
      }

      if (!start.line || !node.position.indent) {
        first = false
        return
github remarkjs / remark-lint / packages / remark-lint-no-table-indentation / index.js View on Github external
function visitor(node) {
    if (!generated(node)) {
      node.children.forEach(each)
    }

    return visit.SKIP
  }
github remarkjs / remark-unwrap-images / index.js View on Github external
function onparagraph(node, index, parent) {
  if (applicable(node) === containsImage) {
    splice.apply(parent.children, [index, 1].concat(node.children))
    return [visit.SKIP, index]
  }
}
github remarkjs / remark-lint / packages / remark-lint-table-cell-padding / index.js View on Github external
if (pref) {
      style = pref === 'padded' ? 1 : 0
    } else {
      style = entries[0] && (!entries[0].start || !entries[0].end) ? 0 : 1
    }

    index = -1
    length = entries.length

    while (++index < length) {
      entry = entries[index]
      checkSide('start', entry, style, sizes)
      checkSide('end', entry, style, sizes)
    }

    return visit.SKIP
  }

unist-util-visit

unist utility to visit nodes

MIT
Latest version published 1 year ago

Package Health Score

77 / 100
Full package analysis