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 1.2.1 to 1.2.2

license

95

index.js

@@ -1,10 +0,10 @@

'use strict';
'use strict'
var visit = require('unist-util-visit');
var is = require('unist-util-is');
var toString = require('nlcst-to-string');
var visit = require('unist-util-visit')
var is = require('unist-util-is')
var toString = require('nlcst-to-string')
module.exports = repeatedWords;
module.exports = repeatedWords
/* List of words which can legally occur twice. */
// List of words which can legally occur twice.
var list = [

@@ -20,40 +20,39 @@ 'had',

'mau'
];
]
/* Check for for repeated words. */
// Check for for repeated words.
function repeatedWords() {
return transformer;
return transformer
}
/* Check. */
function transformer(tree, file) {
visit(tree, 'SentenceNode', visitor);
visit(tree, 'SentenceNode', visitor)
function visitor(parent) {
var children = parent.children;
var length = children.length;
var index = -1;
var child;
var before;
var value;
var node;
var prev;
var message;
var position;
var start;
var children = parent.children
var length = children.length
var index = -1
var child
var before
var value
var node
var prev
var message
var position
var start
while (++index < length) {
child = children[index];
child = children[index]
if (is('WordNode', child)) {
value = toString(child);
node = child;
position = index;
value = toString(child)
node = child
position = index
} else if (is('WhiteSpaceNode', child)) {
start = position;
before = value;
prev = node;
value = node = position = null;
start = position
before = value
prev = node
value = node = position = null
} else {
before = value = prev = node = position = start = null;
before = value = prev = node = position = start = null
}

@@ -65,7 +64,7 @@

end: node.position.end
});
})
message.ruleId = message.source = 'retext-repeated-words';
message.actual = toString(children.slice(start, position));
message.expected = [value];
message.ruleId = message.source = 'retext-repeated-words'
message.actual = toString(children.slice(start, position))
message.expected = [value]
}

@@ -76,33 +75,33 @@ }

/* Check if `value`, a word which occurs twice, should be ignored. */
// Check if `value`, a word which occurs twice, should be ignored.
function ignore(value) {
var head;
var tail;
var head
var tail
/* ...the most heartening exhibition they had had since... */
// ...the most heartening exhibition they had had since...
if (list.indexOf(lower(value)) !== -1) {
return true;
return true
}
head = value.charAt(0);
head = value.charAt(0)
if (head === head.toUpperCase()) {
/* D. D. will pop up with... */
// D. D. will pop up with...
if (value.length === 2 && value.charAt(1) === '.') {
return true;
return true
}
tail = value.slice(1);
tail = value.slice(1)
/* Duran Duran.... Bella Bella.. */
// Duran Duran... Bella Bella...
if (tail === lower(tail)) {
return true;
return true
}
}
return false;
return false
}
function lower(value) {
return value.toLowerCase();
return value.toLowerCase()
}
{
"name": "retext-repeated-words",
"version": "1.2.1",
"version": "1.2.2",
"description": "Check for for repeated words",

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

],
"repository": "wooorm/retext-repeated-words",
"bugs": "https://github.com/wooorm/retext-repeated-words/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"repository": "retextjs/retext-repeated-words",
"bugs": "https://github.com/retextjs/retext-repeated-words/issues",
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"contributors": [
"Titus Wormer <tituswormer@gmail.com> (http://wooorm.com)",
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
"Sylvan Swierkosz <sswierkosz@gmail.com>"

@@ -29,20 +29,20 @@ ],

"devDependencies": {
"browserify": "^14.1.0",
"browserify": "^16.0.0",
"esmangle": "^1.0.1",
"nyc": "^10.0.0",
"remark-cli": "^3.0.0",
"remark-preset-wooorm": "^3.0.0",
"nyc": "^13.0.0",
"prettier": "^1.14.3",
"remark-cli": "^6.0.0",
"remark-preset-wooorm": "^4.0.0",
"retext": "^5.0.0",
"tape": "^4.0.0",
"xo": "^0.18.0"
"xo": "^0.23.0"
},
"scripts": {
"build-md": "remark . -qfo",
"format": "remark . -qfo && prettier --write \"**/*.js\" && xo --fix",
"build-bundle": "browserify index.js --bare -s retextRepeatedWords > retext-repeated-words.js",
"build-mangle": "esmangle retext-repeated-words.js > retext-repeated-words.min.js",
"build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"lint": "xo",
"build": "npm run build-bundle && npm run build-mangle",
"test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js",
"test": "npm run build && npm run lint && npm run test-coverage"
"test": "npm run format && npm run build && npm run test-coverage"
},

@@ -55,4 +55,12 @@ "nyc": {

},
"prettier": {
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": false,
"semi": false,
"trailingComma": "none"
},
"xo": {
"space": true,
"prettier": true,
"esnext": false,

@@ -59,0 +67,0 @@ "rules": {

@@ -1,2 +0,2 @@

# retext-repeated-words [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]
# retext-repeated-words [![Build][build-badge]][build] [![Coverage][coverage-badge]][coverage] [![Downloads][downloads-badge]][downloads] [![Chat][chat-badge]][chat]

@@ -25,8 +25,8 @@ Check for ~~`for`~~ repeated words with [**retext**][retext].

```javascript
var vfile = require('to-vfile');
var report = require('vfile-reporter');
var unified = require('unified');
var english = require('retext-english');
var stringify = require('retext-stringify');
var repeated = require('retext-repeated-words');
var vfile = require('to-vfile')
var report = require('vfile-reporter')
var unified = require('unified')
var english = require('retext-english')
var stringify = require('retext-stringify')
var repeated = require('retext-repeated-words')

@@ -37,5 +37,5 @@ unified()

.use(stringify)
.process(vfile.readSync('example.txt'), function (err, file) {
console.error(report(err || file));
});
.process(vfile.readSync('example.txt'), function(err, file) {
console.error(report(err || file))
})
```

@@ -67,7 +67,15 @@

* [`retext-indefinite-article`](https://github.com/wooorm/retext-indefinite-article)
* [`retext-indefinite-article`](https://github.com/retextjs/retext-indefinite-article)
— Check if indefinite articles are used correctly
* [`retext-redundant-acronyms`](https://github.com/wooorm/retext-redundant-acronyms)
* [`retext-redundant-acronyms`](https://github.com/retextjs/retext-redundant-acronyms)
— Check for redundant acronyms
## Contribute
See [`contributing.md` in `retextjs/retext`][contribute] for ways to get
started.
This organisation has a [Code of Conduct][coc]. By interacting with this
repository, organisation, or community you agree to abide by its terms.
## License

@@ -79,16 +87,28 @@

[travis-badge]: https://img.shields.io/travis/wooorm/retext-repeated-words.svg
[build-badge]: https://img.shields.io/travis/retextjs/retext-repeated-words.svg
[travis]: https://travis-ci.org/wooorm/retext-repeated-words
[build]: https://travis-ci.org/retextjs/retext-repeated-words
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/retext-repeated-words.svg
[coverage-badge]: https://img.shields.io/codecov/c/github/retextjs/retext-repeated-words.svg
[codecov]: https://codecov.io/github/wooorm/retext-repeated-words
[coverage]: https://codecov.io/github/retextjs/retext-repeated-words
[downloads-badge]: https://img.shields.io/npm/dm/retext-repeated-words.svg
[downloads]: https://www.npmjs.com/package/retext-repeated-words
[chat-badge]: https://img.shields.io/badge/join%20the%20community-on%20spectrum-7b16ff.svg
[chat]: https://spectrum.chat/unified/retext
[npm-install]: https://docs.npmjs.com/cli/install
[license]: LICENSE
[license]: license
[author]: http://wooorm.com
[author]: https://wooorm.com
[retext]: https://github.com/wooorm/retext
[retext]: https://github.com/retextjs/retext
[contribute]: https://github.com/retextjs/retext/blob/master/contributing.md
[coc]: https://github.com/retextjs/retext/blob/master/code-of-conduct.md
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