retext-repeated-words
Advanced tools
Comparing version 1.1.0 to 1.2.0
29
index.js
@@ -1,12 +0,3 @@ | ||
/** | ||
* @author Titus Wormer | ||
* @copyright 2016 Titus Wormer | ||
* @license MIT | ||
* @module retext-repeated-words | ||
* @fileoverview Check for for repeated words. | ||
*/ | ||
'use strict'; | ||
/* Dependencies. */ | ||
var visit = require('unist-util-visit'); | ||
@@ -16,3 +7,2 @@ var is = require('unist-util-is'); | ||
/* Expose. */ | ||
module.exports = repeatedWords; | ||
@@ -40,3 +30,5 @@ | ||
function transformer(tree, file) { | ||
visit(tree, 'SentenceNode', function (parent) { | ||
visit(tree, 'SentenceNode', visitor); | ||
function visitor(parent) { | ||
var children = parent.children; | ||
@@ -51,2 +43,4 @@ var length = children.length; | ||
var message; | ||
var position; | ||
var start; | ||
@@ -59,8 +53,10 @@ while (++index < length) { | ||
node = child; | ||
position = index; | ||
} else if (is('WhiteSpaceNode', child)) { | ||
start = position; | ||
before = value; | ||
prev = node; | ||
value = node = null; | ||
value = node = position = null; | ||
} else { | ||
before = value = prev = node = null; | ||
before = value = prev = node = position = start = null; | ||
} | ||
@@ -75,5 +71,7 @@ | ||
message.ruleId = message.source = 'retext-repeated-words'; | ||
message.actual = toString(children.slice(start, position)); | ||
message.expected = [value]; | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
@@ -92,5 +90,4 @@ | ||
head = value.charAt(0); | ||
head = head === head.toUpperCase(); | ||
if (head) { | ||
if (head === head.toUpperCase()) { | ||
/* D. D. will pop up with... */ | ||
@@ -97,0 +94,0 @@ if (value.length === 2 && value.charAt(1) === '.') { |
{ | ||
"name": "retext-repeated-words", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Check for for repeated words", | ||
@@ -24,16 +24,17 @@ "license": "MIT", | ||
"contributors": [ | ||
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)" | ||
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)", | ||
"Sylvan Swierkosz <sswierkosz@gmail.com>" | ||
], | ||
"devDependencies": { | ||
"browserify": "^13.0.1", | ||
"browserify": "^14.1.0", | ||
"esmangle": "^1.0.1", | ||
"nyc": "^8.1.0", | ||
"remark-cli": "^2.0.0", | ||
"remark-preset-wooorm": "^1.0.0", | ||
"retext": "^4.0.0", | ||
"nyc": "^10.0.0", | ||
"remark-cli": "^3.0.0", | ||
"remark-preset-wooorm": "^2.0.0", | ||
"retext": "^5.0.0", | ||
"tape": "^4.0.0", | ||
"xo": "^0.16.0" | ||
"xo": "^0.17.1" | ||
}, | ||
"scripts": { | ||
"build-md": "remark . --quiet --frail", | ||
"build-md": "remark . -qfo", | ||
"build-bundle": "browserify index.js --bare -s retextRepeatedWords > retext-repeated-words.js", | ||
@@ -60,5 +61,4 @@ "build-mangle": "esmangle retext-repeated-words.js > retext-repeated-words.min.js", | ||
"remarkConfig": { | ||
"output": true, | ||
"presets": "wooorm" | ||
"plugins": ["preset-wooorm"] | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6742
87