# wasmlibfp

> The WASM target for the `libfp` project

Latest version **0.9.1** (published 2020-03-19) · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.1 |
| Published | 2020-03-19 |
| First published | 2019-10-02 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 254.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | terbiumlabs |

## Links

- npm: https://www.npmjs.com/package/wasmlibfp
- npm.io page: https://npm.io/package/wasmlibfp

## Recent versions

- 0.9.1 (latest) — 2020-03-19
- 0.8.1 — 2019-12-30
- 0.8.0 — 2019-12-09
- 0.7.0 — 2019-12-02
- 0.6.0 — 2019-10-29
- 0.5.1 — 2019-10-29
- 0.5.0 — 2019-10-29
- 0.4.0 — 2019-10-11
- 0.3.0 — 2019-10-03
- 0.2.0 — 2019-10-03
- 0.1.0 — 2019-10-02

## README

# wasmlibfp
The WASM target for the `libfp` project

## Getting Started
You can install `wasmlibfp` using npm:

```bash
npm install --save wasmlibfp
```

Once `wasmlibfp` is in your project, you can start fingerprinting data.

```javascript
import * as libfp from "wasmlibfp";

const source_string = "   Thi!@s is S0om3e     broken te3xt  ";
const cleaned = libfp.clean_string(source_string);
console.log(cleaned); // should print: " THIS IS SOME BROKEN TEXT "

const email = "test@example.org";
const field = JSON.parse(libfp.field_from_email("label", email));

console.log(field.variants); // should print an array of arrays containing two fingerprints.
```

## API
The available API is:

```javascript
// general functions (not used often)
clean_string(source: string): string;
fingerprint_chunk(source: string): string;
fingerprint(source: string, mode: int, tiled: bool): array;
fingerprint_email(source: string): string;
fingerprint_email_from_sha1(source: string): string;
fingerprint_email_sha1(source: string): string

// field functions (all return stringified JSON)
field_from_name(label: string, first_name: string, middle_name: string, last_name: string): string;
field_from_address(label: string, address: string): string;
field_from_region(label: string, city: string, province: string, postal_code: string): string;
field_from_phone(label: string, phone: string): string;
field_from_ssn(label: string, ssn: string): string;
field_from_email(label: string, email: string): string;
```

The stringifed JSON structure for a field is:

```json
{
	"label": "field_label",
	"field_type": "email|phone|name|ssn|address|region",
	"variants": [
		[ "fingerprints", "representing", "a single", "variant" ],
		[ "fingerprints", "representing", "another", "variant" ]
	]
}
```

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