Skip to content

Commit

Permalink
docs: improve 'usage' section
Browse files Browse the repository at this point in the history
  • Loading branch information
fityannugroho committed Nov 14, 2023
1 parent 368035a commit c340836
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,42 @@ npm install wisely

## Usage

### Obscures the entire text

```js
import wisely from 'wisely';

const text = 'Palestine will be free! Freedom is the right of ALL nations!';

// Obscuring the whole text
const res1 = wisely({ text });
console.log(wisely({ text }));
// P@l3$t|n3 w!ll 83 fr33! Fr33d0m |$ t#3 r!6#t 0f @LL n4t|0n5!
```

// Only obscures the specified phrases
const res2 = wisely({ text, phrases: ['palestine', 'free'] });
### Obscures certain phrases

console.log(res1, res2);
// P@l3$t|n3 w!ll 83 fr33! Fr33d0m |$ t#3 r!6#t 0f @LL n4t|0n5!
```js
console.log(wisely({ text, phrases: ['palestine', 'free'] }));
// P4l35t1n3 will be fr33! Freedom is the right of ALL nations!
```

### Obscures with custom character set

```js
const customCharSet = {
a: ['@', '4'],
e: ['3'],
i: ['1', '!'],
o: ['0'],
s: ['5', '$'],
t: ['7'],
};

console.log(wisely({ text, charSets: [customCharSet] }));
// P@l3$7!n3 w1ll b3 fr33! Fr33d0m 1$ 7h3 r1gh7 0f 4LL n@710n$!
```

> See [`options.charsets`](#charsets) for more details.
## API

### `wisely(options)`
Expand Down

0 comments on commit c340836

Please sign in to comment.