Skip to content
plugin to check if indefinite articles (a and an) are used correctly
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
.editorconfig
.gitignore
.npmrc
.prettierignore
.travis.yml
index.js
license
package.json
readme.md
test.js

readme.md

retext-indefinite-article

Build Coverage Downloads Size Sponsors Backers Chat

retext plugin to check if indefinite articles (a and an) are used correctly.

Install

npm:

npm install retext-indefinite-article

Use

Say we have the following file, example.txt:

He should, a 8-year old boy, should have arrived a hour
ago on an European flight.  An historic event, or a
historic event? Both are fine.

…and our script, example.js, looks like this:

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 indefiniteArticle = require('retext-indefinite-article')

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

Now, running node example yields:

example.txt
  1:12-1:13  warning  Use `an` before `8-year`, not `a`    retext-indefinite-article  retext-indefinite-article
  1:50-1:51  warning  Use `an` before `hour`, not `a`      retext-indefinite-article  retext-indefinite-article
   2:8-2:10  warning  Use `a` before `European`, not `an`  retext-indefinite-article  retext-indefinite-article

⚠ 3 warnings

API

retext().use(indefiniteArticle)

Check if indefinite articles (a and an) are used correctly (which isn’t as simple as checking vowels as it has to do with sounds). Knows about how digits are pronounced as well.

Related

Contribute

See contributing.md in retextjs/.github for ways to get started. See support.md for ways to get help.

This project has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer

You can’t perform that action at this time.