Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

retext-repeated-words

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

retext-repeated-words - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

13

index.d.ts
/**
* A retext plugin to check for ~for~ repeated words.
* A retext plugin to check for for repeated words.
*

@@ -9,6 +9,13 @@ * * Doesn’t warn for some words which *do* occur twice (`the best exhibition

*
* @type {import('unified').Plugin<[]>}
* @type {import('unified').Plugin<[], Root>}
*/
export default function retextRepeatedWords():
| void
| import('unified').Transformer
| import('unified').Transformer<import('nlcst').Root, import('nlcst').Root>
export type Root = import('nlcst').Root
export type SentenceContent = import('nlcst').SentenceContent
export type Info = {
value: string
child: SentenceContent
index: number
}

@@ -0,3 +1,8 @@

/**
* @typedef {import('nlcst').Root} Root
* @typedef {import('nlcst').SentenceContent} SentenceContent
* @typedef {{value: string, child: SentenceContent, index: number}} Info
*/
import {toString} from 'nlcst-to-string'
import {convert} from 'unist-util-is'
import {visit, SKIP} from 'unist-util-visit'

@@ -8,5 +13,2 @@ import {pointStart, pointEnd} from 'unist-util-position'

const word = convert('WordNode')
const whiteSpace = convert('WhiteSpaceNode')
// List of words that can legally occur twice.

@@ -33,13 +35,7 @@ const list = new Set([

*
* @type {import('unified').Plugin<[]>}
* @type {import('unified').Plugin<[], Root>}
*/
export default function retextRepeatedWords() {
/**
* @typedef {import('unist').Node} Node
* @typedef {import('unist').Parent} Parent
* @typedef {{value: string, child: Node, index: number}} Info
*/
return (tree, file) => {
visit(tree, 'SentenceNode', (/** @type {Parent} */ parent) => {
visit(tree, 'SentenceNode', (parent) => {
let index = -1

@@ -54,3 +50,3 @@ /** @type {Info|undefined} */

if (word(child)) {
if (child.type === 'WordNode') {
const value = toString(child)

@@ -79,3 +75,3 @@

}
} else if (whiteSpace(child)) {
} else if (child.type === 'WhiteSpaceNode') {
previous = current

@@ -82,0 +78,0 @@ current = undefined

{
"name": "retext-repeated-words",
"version": "4.0.0",
"version": "4.1.0",
"description": "retext plugin to check for for repeated words",

@@ -36,7 +36,7 @@ "license": "MIT",

"dependencies": {
"@types/nlcst": "^1.0.0",
"nlcst-to-string": "^3.0.0",
"unified": "^10.0.0",
"unist-util-is": "^5.0.0",
"unist-util-position": "^4.0.0",
"unist-util-visit": "^3.0.0"
"unist-util-visit": "^4.0.0"
},

@@ -48,4 +48,4 @@ "devDependencies": {

"prettier": "^2.0.0",
"remark-cli": "^9.0.0",
"remark-preset-wooorm": "^8.0.0",
"remark-cli": "^10.0.0",
"remark-preset-wooorm": "^9.0.0",
"retext": "^8.0.0",

@@ -56,3 +56,3 @@ "rimraf": "^3.0.0",

"typescript": "^4.0.0",
"xo": "^0.39.0"
"xo": "^0.44.0"
},

@@ -59,0 +59,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc