2.9.1 • Published 1 day ago
autocorrect-node v2.9.1
AutoCorrect for Node.js
The Native Node.js version of AutoCorrect built on NAPI.RS.
- Rust - autocorrect
- Ruby - autocorrect-rb
- Go - autocorrect-go
- Python - autocorrect-py
- Node.js - autocorrect-node
- JavaScript (Browser) - autocorrect-wasm
- Java - autocorrect-java
Installation
$ yarn add autocorrect-node
Use CLI
$ yarn autocorrect -h
Lint you files
$ yarn autocorrect --lint .
Work with Lint-Staged
If you are use lint-staged
, you can add this config to your package.json
for run AutoCorrect lint before commit for changed files.
{
"lint-staged": {
"*": [
"autocorrect --lint"
]
}
}
Usage
const autocorrect = require('autocorrect-node');
const out = autocorrect.format('Hello你好.');
console.log(out);
// Hello 你好。
out = autocorrect.formatFor("let title = 'Hello你好。'", 'js');
// let title = 'Hello 你好。'
const result = autocorrect.lintFor("let title = 'Hello你好。'", 'js');
console.log(result);
// {
// filepath: 'js',
// lines: [
// { l: 1, c: 13, new: "'Hello 你好。'", old: "'Hello你好。'", severity: 1 }
// ],
// error: ''
// }
// Load Config
const configStr = JSON.stringify({ textRules: { 你好hello: 0 } });
autocorrect.loadConfig(configStr);
out = autocorrect.format('Hello你好.');
console.log(out);
// Hello 你好。
out = autocorrect.format('你好hello');
console.log(out);
// 你好hello
// Ignorer, if /path/to/workdir contains .autocorrectignore or .gitignore
const ignorer = new autocorrect.Ignorer('/path/to/workdir');
ignorer.isIgnored('README.md');
2.9.1
1 day ago
2.9.0
5 months ago
2.7.0
9 months ago
2.8.1
9 months ago
2.7.2
9 months ago
2.8.0
9 months ago
2.7.1
9 months ago
2.7.0-beta2
9 months ago
2.7.0-beta1
9 months ago
2.8.3
9 months ago
2.8.2
9 months ago
2.8.4
9 months ago
2.6.2
1 year ago
2.5.5
1 year ago
2.5.8
1 year ago
2.6.1
1 year ago
2.6.0
1 year ago
2.5.3
1 year ago
2.5.2
1 year ago
2.5.1
1 year ago
2.5.0
1 year ago
2.4.3
2 years ago
2.4.2
2 years ago
2.4.1
2 years ago
2.4.0
2 years ago
2.3.2
2 years ago
2.3.1
2 years ago
2.3.0
2 years ago
2.2.0
2 years ago
2.1.1
2 years ago