syntax-tree / mdast-util-find-and-replace

Compare 21e09e8 ... +2 ... 0e123da

Coverage Reach
index.js

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 4 files from the diff.
Other files ignored by Codecov
package.json has changed.
test.js has changed.
readme.md has changed.

@@ -28,15 +28,15 @@
Loading
28 28
29 29
/**
30 30
 * @callback ReplaceFunction
31 -
 * @param {...unknown} parameters
31 +
 * @param {...any} parameters
32 32
 * @returns {Array.<PhrasingContent>|PhrasingContent|string|false|undefined|null}
33 33
 */
34 34
35 35
import escape from 'escape-string-regexp'
36 36
import {visitParents} from 'unist-util-visit-parents'
37 37
import {convert} from 'unist-util-is'
38 38
39 -
var own = {}.hasOwnProperty
39 +
const own = {}.hasOwnProperty
40 40
41 41
/**
42 42
 * @param tree mdast tree
@@ -64,9 +64,9 @@
Loading
64 64
     */
65 65
    function (tree, find, replace, options) {
66 66
      /** @type {Options} */
67 -
      var settings
67 +
      let settings
68 68
      /** @type {FindAndReplaceSchema|FindAndReplaceList} */
69 -
      var schema
69 +
      let schema
70 70
71 71
      if (typeof find === 'string' || find instanceof RegExp) {
72 72
        // @ts-expect-error don’t expect options twice.
@@ -82,9 +82,9 @@
Loading
82 82
        settings = {}
83 83
      }
84 84
85 -
      var ignored = convert(settings.ignore || [])
86 -
      var pairs = toPairs(schema)
87 -
      var pairIndex = -1
85 +
      const ignored = convert(settings.ignore || [])
86 +
      const pairs = toPairs(schema)
87 +
      let pairIndex = -1
88 88
89 89
      while (++pairIndex < pairs.length) {
90 90
        visitParents(tree, 'text', visitor)
@@ -94,11 +94,11 @@
Loading
94 94
95 95
      /** @type {import('unist-util-visit-parents').Visitor<Text>} */
96 96
      function visitor(node, parents) {
97 -
        var index = -1
97 +
        let index = -1
98 98
        /** @type {Parent} */
99 -
        var parent
99 +
        let parent
100 100
        /** @type {Parent} */
101 -
        var grandparent
101 +
        let grandparent
102 102
103 103
        while (++index < parents.length) {
104 104
          // @ts-expect-error mdast vs. unist parent.
@@ -127,18 +127,18 @@
Loading
127 127
       * @returns {VisitorResult}
128 128
       */
129 129
      function handler(node, parent) {
130 -
        var find = pairs[pairIndex][0]
131 -
        var replace = pairs[pairIndex][1]
130 +
        const find = pairs[pairIndex][0]
131 +
        const replace = pairs[pairIndex][1]
132 132
        /** @type {Array.<PhrasingContent>} */
133 -
        var nodes = []
134 -
        var start = 0
135 -
        var index = parent.children.indexOf(node)
133 +
        let nodes = []
134 +
        let start = 0
135 +
        let index = parent.children.indexOf(node)
136 136
        /** @type {number} */
137 -
        var position
137 +
        let position
138 138
        /** @type {RegExpMatchArray} */
139 -
        var match
139 +
        let match
140 140
        /** @type {Array.<PhrasingContent>|PhrasingContent|string|false|undefined|null} */
141 -
        var value
141 +
        let value
142 142
143 143
        find.lastIndex = 0
144 144
@@ -196,11 +196,11 @@
Loading
196 196
 * @returns {Pairs}
197 197
 */
198 198
function toPairs(schema) {
199 -
  var index = -1
199 +
  let index = -1
200 200
  /** @type {Pairs} */
201 -
  var result = []
201 +
  const result = []
202 202
  /** @type {string} */
203 -
  var key
203 +
  let key
204 204
205 205
  if (typeof schema !== 'object') {
206 206
    throw new TypeError('Expected array or object as schema')

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
index.js 100.00%
Project Totals (1 files) 100.00%
Loading