# typogen

> Introduce configurable typos into a string.

Latest version **1.0.0** (published 2019-08-28) · ISC license · 0 weekly downloads

## Install

```sh
npm install typogen
pnpm add typogen
yarn add typogen
bun add typogen
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-08-28 |
| First published | 2019-08-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | eb3095 |
| Maintainers | eb3095 |
| Keywords | typo, typos, text, message, string, spelling, misspelling |

## Links

- npm: https://www.npmjs.com/package/typogen
- Repository: https://github.com/eb3095/typogen
- Homepage: https://github.com/eb3095/typogen#readme
- Issues: https://github.com/eb3095/typogen/issues
- npm.io page: https://npm.io/package/typogen

## Alternatives

- [@mce/gif](https://npm.io/package/@mce/gif.md) — 2.6K weekly downloads
- [cleanse](https://npm.io/package/cleanse.md) — 173 weekly downloads
- [str](https://npm.io/package/str.md) — 127 weekly downloads
- [naming](https://npm.io/package/naming.md) — 95 weekly downloads
- [tap-telco-api](https://npm.io/package/tap-telco-api.md) — 19 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-08-28

## README

# typogen
Introduce configurable typos into a string.

### Usage

```javascript
// Require the project
const Typo = require('typogen').Typo;

// This library will load a default config unless one is specified
// See bellow for the details of the config structure
var config = require('./defaults.json');

// Create the Typo object
var typo = new Typo(config);

// Take a string
let string = "This is a common string. There are some things we could misspell. Don't forget it's random!";

// Introduce typos at random
string = typo.introduceTypos(string);

console.log(string);
```

### Configuration

* typoRate is in 10ths of a percent. 1 = 0.1%, 10 = 1%, 100 = 10%.
* typoCommas is to forget commas
* typoApostrophes is to forget apostrophes
* typoCase is to forget to capitalize
* speechParts.string is the word to be misspelled
* speechParts.typos are the randomly chosen typos to introduce

Json Configuration,
```json
{
  "typoRate": 100,
  "typoCommas": true,
  "typoApostrophes": true,
  "typoCase": true,
  "speechParts": [
    {
      "string": "they're",
      "typos": [
        "theyre",
        "there",
        "their"
      ]
    },
    {
      "string": "theyre",
      "typos": [
        "there",
        "their"
      ]
    },
    {
      "string": "their",
      "typos": [
        "there",
        "theyre"
      ]
    },
    {
      "string": "there",
      "typos": [
        "theyre",
        "their"
      ]
    },
    {
      "string": "your",
      "typos": [
        "youre"
      ]
    },
    {
      "string": "youre",
      "typos": [
        "your"
      ]
    },
    {
      "string": "you're",
      "typos": [
        "your"
      ]
    },
    {
      "string": "you",
      "typos": [
        "u"
      ]
    },
    {
      "string": "ei",
      "typos": [
        "ie",
        "ee"
      ]
    },
    {
      "string": "ie",
      "typos": [
        "ee",
        "ei"
      ]
    },
    {
      "string": "ai",
      "typos": [
        "ia"
      ]
    },
    {
      "string": "ia",
      "typos": [
        "ai"
      ]
    },
    {
      "string": "qu",
      "typos": [
        "q"
      ]
    }
  ]
}
```

Javascript Configuration
```javascript
var config = {
    typoRate: 100,
    typoCommas: true,
    typoApostrophes: true,
    typoCase: true,
    speechParts: [
        {
            string: "they're",
            typos: [
                "theyre",
                "there",
                "their"
            ]
        },
        {
            string: "theyre",
            typos: [
                "there",
                "their"
            ]
        },
        {
            string: "their",
            typos: [
                "there",
                "theyre"
            ]
        },
        {
            string: "there",
            typos: [
                "theyre",
                "their"
            ]
        },
        {
            string: "your",
            typos: [
                "youre"
            ]
        },
        {
            string: "youre",
            typos: [
                "your"
            ]
        },
        {
            string: "you're",
            typos: [
                "your"
            ]
        },
        {
            string: "you",
            typos: [
                "u"
            ]
        },
        {
            string: "ei",
            typos: [
                "ie",
                "ee"
            ]
        },
        {
            string: "ie",
            typos: [
                "ee",
                "ei"
            ]
        },
        {
            string: "ai",
            typos: [
                "ia"
            ]
        },
        {
            string: "ia",
            typos: [
                "ai"
            ]
        },
        {
            string: "qu",
            typos: [
                "q"
            ]
        }
    ]
};
```

---
_Source: https://npm.io/package/typogen · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
