Skip to content

Commit 569a4ba

Browse files
authored
Merge pull request #7 from NointidWorks/odsamuels/docs/improve-readme-357
docs: fix typos and improve clarity in README
2 parents 41fe921 + 519e97c commit 569a4ba

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,28 @@ Remove personally identifiable information from text.
66

77
> This package is published on npm as [piiranha](https://www.npmjs.com/package/piiranha) and is maintained as a fork of the original [solvvy/redact-pii](https://github.com/solvvy/redact-pii) package.
88
9-
### Prerequesites
9+
### Prerequisites
1010

11-
This library is primarily written for node.js but it should work in the browser as well.
12-
It is written in TypeScript and compiles to ES2017. The library makes use of `async` functions and hence needs node.js 8.0.0 or higher (or a modern browser).
11+
This library is primarily written for Node.js, but also works in the browser with compatible tooling/runtime (such as Vite, Webpack, Rollup, Parcel, esbuild). A transpiler/build setup such as TypeScript compiler, Babel, or both, can be used to target older browser support.
12+
It is written in TypeScript and currently compiles to ES2016.
13+
The project is tested in CI on Node.js 18.x and 20.x.
1314

1415
### Simple example (synchronous API)
1516

1617
```
1718
npm install piiranha
1819
```
1920

21+
```js
22+
import { SyncRedactor } from 'piiranha';
23+
const redactor = new SyncRedactor();
24+
const redactedText = redactor.redact('Hi David Johnson, Please give me a call at 555-555-5555');
25+
// Hi NAME, Please give me a call at PHONE_NUMBER
26+
console.log(redactedText);
27+
```
28+
29+
CommonJS equivalent:
30+
2031
```js
2132
const { SyncRedactor } = require('piiranha');
2233
const redactor = new SyncRedactor();
@@ -28,7 +39,7 @@ console.log(redactedText);
2839
### Simple example (asynchronous / promise-based API)
2940

3041
```js
31-
const { AsyncRedactor } = require('piiranha');
42+
import { AsyncRedactor } from 'piiranha';
3243
const redactor = new AsyncRedactor();
3344
redactor.redactAsync('Hi David Johnson, Please give me a call at 555-555-5555').then((redactedText) => {
3445
// Hi NAME, Please give me a call at PHONE_NUMBER
@@ -61,7 +72,7 @@ redactor.redactAsync('Hi David Johnson, Please give me a call at 555-555-5555').
6172
### Customize replacement values
6273

6374
```js
64-
const { SyncRedactor } = require('piiranha');
75+
import { SyncRedactor } from 'piiranha';
6576

6677
// use a single replacement value for all built-in patterns found.
6778
const redactor = new SyncRedactor({ globalReplaceWith: 'TOP_SECRET' });
@@ -86,7 +97,7 @@ redactor.redact('Dear David Johnson');
8697
Note that the order of redaction rules matters, therefore you have to decide whether you want your custom redaction rules to run `before` or `after` the built-in ones. Generally it's better to put very specialized patterns or functions `before` the built-in ones and more broad / general ones `after`.
8798

8899
```js
89-
const { SyncRedactor } = require('piiranha');
100+
import { SyncRedactor } from 'piiranha';
90101

91102
// add a custom regexp pattern
92103
const redactor = new SyncRedactor({

0 commit comments

Comments
 (0)