Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Nov 7, 2021
1 parent db419c2 commit 6d37124
Showing 1 changed file with 81 additions and 13 deletions.
94 changes: 81 additions & 13 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,64 @@
[![Downloads][downloads-badge]][downloads]
[![Size][size-badge]][size]

Clean-up [cuss][] (`c*ss`, `c**s`, `@#$%`) words.
Clean-up cuss words.

## Contents

* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [`vowel(value[, character])`](#vowelvalue-character)
* [`inner(value[, character])`](#innervalue-character)
* [`grawlix(value[, pattern])`](#grawlixvalue-pattern)
* [Types](#types)
* [Compatibility](#compatibility)
* [Security](#security)
* [Related](#related)
* [Contribute](#contribute)
* [License](#license)

## What is this?

This package provides three ways to clean obscene strings: vowels (`c*ss`),
inner letters (`c**s`), and grawlix (`@#$%`).

> Not affiliated with Football Club København.
## Install
## When should I use this?

Maybe when you have some cuss words in your tests that you’re tired of looking
at?

This package is ESM only: Node 12+ is needed to use it and it must be `import`ed
instead of `require`d.
## Install

[npm][]:
This package is [ESM only][esm].
In Node.js (version 12.20+, 14.14+, or 16.0+), install with [npm][]:

```sh
npm install f-ck
```

In Deno with [Skypack][]:

```js
import * as fck from 'https://cdn.skypack.dev/f-ck@2?dts'
```

In browsers with [Skypack][]:

```html
<script type="module">
import * as fck from 'https://cdn.skypack.dev/f-ck@2?min'
</script>
```

## Use

```js
import {vowel, inner, grawlix} = require('f-ck')
import {vowel, inner, grawlix} from 'f-ck'

console.log(vowel('butt')) // => 'b*tt'
console.log(inner('butt')) // => 'b**t'
Expand All @@ -40,26 +79,47 @@ There is no default export.

### `vowel(value[, character])`

Sanitize `value` by replacing vowels in `value` with `character` (default:
`'*'`).
Sanitize `value` (`string`) by replacing vowels in `value` with `character`
(`string`, default: `'*'`).

### `inner(value[, character])`

Sanitize `value` by replacing all characters except the first and last in
`value` with `character` (default: `'*'`).
Sanitize `value` (`string`) by replacing all characters except the first and
last in `value` with `character` (`string`, default: `'*'`).

### `grawlix(value[, pattern])`

Sanitize `value` using a [grawlix][] pattern (default: `'@#$%!&?'`).
Sanitize `value` (`string` or `number`) using a [grawlix][] pattern (`string`,
default: `'@#$%!&?'`).
Essentially, repeats `pattern` for `value` (when `number`) or `value.length`
(when `string`) characters.

## Types

This package is fully typed with [TypeScript][].
There are no extra exported types.

## Compatibility

This package is at least compatible with all maintained versions of Node.js.
As of now, that is Node.js 12.20+, 14.14+, and 16.0+.
It also works in Deno and modern browsers.

## Security

This package is safe.

## Related

* [`profanities`][profanities]
List of (possible) English profane words
list of (possible) English profane words
* [`cuss`][cuss]
— Map of English profane words to a rating of sureness
— map of English profane words to a rating of sureness

## Contribute

Yes please!
See [How to Contribute to Open Source][contribute].

## License

Expand All @@ -85,10 +145,18 @@ Essentially, repeats `pattern` for `value` (when `number`) or `value.length`

[npm]: https://docs.npmjs.com/cli/install

[skypack]: https://www.skypack.dev

[license]: license

[author]: https://wooorm.com

[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

[typescript]: https://www.typescriptlang.org

[contribute]: https://opensource.guide/how-to-contribute/

[grawlix]: https://en.wikipedia.org/wiki/The_Lexicon_of_Comicana

[cuss]: https://github.com/words/cuss
Expand Down

0 comments on commit 6d37124

Please sign in to comment.