tipo

Typo generator

Usage no npm install needed!

<script type="module">
  import tipo from 'https://cdn.skypack.dev/tipo';
</script>

README

tipo

Generate common typos for words.

API

Build Status

getKeyboardMissTypos(String word) -> Array<String> typos

Returns a list of all words with one letter replaced by a neighbouring key.

Example:

var typos = tipo.getKeyboardMissTypos('cat');
console.log(typos);
// [
//   'xat', 'vat', 'fat', 'dat', 'czt', 'cst', 'cwt',
//   'cqt', 'car', 'caf', 'cag', 'cay', 'ca6', 'ca5'
// ]

getMissingLetterTypos(String word) -> Array<String> typos

Returns a list of all words with a missing letter.

Example:

var typos = tipo.getMissingLetterTypos('cat');
console.log(typos);
// [ 'at', 'ct', 'ca' ]

getDoubleLetterTypos(String word) -> Array<String> typos

Returns a list of words with a repeated letter.

Example:

var typos = tipo.getDoubleLetterTypos('cat');
console.log(typos);
// [ 'ccat', 'caat', 'catt' ]

getMixedLetterTypos(String word) -> Array<String> typos

Returns a list of words where two letters are swapped.

Example:

var typos = tipo.getMixedLetterTypos('cat');
console.log(typos);
// [ 'act', 'cta' ]

getTypos(String word) -> Array<String> typos

Returns a combination of all typo's.

Example:

var typos = tipo.getTypos('cat');
console.log(typos);
// [
//   'xat', 'vat', 'fat', 'dat', 'czt', 'cst', 'cwt', 'cqt', 'car', 'caf',
//   'cag', 'cay', 'ca6', 'ca5', 'at', 'ct', 'ca', 'ccat', 'caat', 'catt',
//   'act', 'cta'
// ]