Socket
Socket
Sign inDemoInstall

mdast-util-find-and-replace

Package Overview
Dependencies
4
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.0.1

2

index.d.ts

@@ -52,3 +52,3 @@ /**

export type ReplaceFunction = (
...parameters: unknown[]
...parameters: any[]
) =>

@@ -55,0 +55,0 @@ | Array<PhrasingContent>

@@ -31,3 +31,3 @@ /**

* @callback ReplaceFunction
* @param {...unknown} parameters
* @param {...any} parameters
* @returns {Array.<PhrasingContent>|PhrasingContent|string|false|undefined|null}

@@ -40,3 +40,3 @@ */

var own = {}.hasOwnProperty
const own = {}.hasOwnProperty

@@ -69,5 +69,5 @@ /**

/** @type {Options} */
var settings
let settings
/** @type {FindAndReplaceSchema|FindAndReplaceList} */
var schema
let schema

@@ -88,5 +88,5 @@ if (typeof find === 'string' || find instanceof RegExp) {

var ignored = convert(settings.ignore || [])
var pairs = toPairs(schema)
var pairIndex = -1
const ignored = convert(settings.ignore || [])
const pairs = toPairs(schema)
let pairIndex = -1

@@ -101,7 +101,7 @@ while (++pairIndex < pairs.length) {

function visitor(node, parents) {
var index = -1
let index = -1
/** @type {Parent} */
var parent
let parent
/** @type {Parent} */
var grandparent
let grandparent

@@ -135,14 +135,14 @@ while (++index < parents.length) {

function handler(node, parent) {
var find = pairs[pairIndex][0]
var replace = pairs[pairIndex][1]
const find = pairs[pairIndex][0]
const replace = pairs[pairIndex][1]
/** @type {Array.<PhrasingContent>} */
var nodes = []
var start = 0
var index = parent.children.indexOf(node)
let nodes = []
let start = 0
let index = parent.children.indexOf(node)
/** @type {number} */
var position
let position
/** @type {RegExpMatchArray} */
var match
let match
/** @type {Array.<PhrasingContent>|PhrasingContent|string|false|undefined|null} */
var value
let value

@@ -205,7 +205,7 @@ find.lastIndex = 0

function toPairs(schema) {
var index = -1
let index = -1
/** @type {Pairs} */
var result = []
const result = []
/** @type {string} */
var key
let key

@@ -212,0 +212,0 @@ if (typeof schema !== 'object') {

{
"name": "mdast-util-find-and-replace",
"version": "2.0.0",
"version": "2.0.1",
"description": "mdast utility to find and replace text in a tree",

@@ -69,7 +69,3 @@ "license": "MIT",

"xo": {
"prettier": true,
"rules": {
"no-var": "off",
"prefer-arrow-callback": "off"
}
"prettier": true
},

@@ -84,4 +80,7 @@ "remarkConfig": {

"detail": true,
"strict": true
"strict": true,
"ignoreFiles": [
"index.d.ts"
]
}
}

@@ -31,3 +31,3 @@ # mdast-util-find-and-replace

var tree = u('paragraph', [
const tree = u('paragraph', [
u('text', 'Some '),

@@ -34,0 +34,0 @@ u('emphasis', [u('text', 'emphasis')]),

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc