# know-parser

> A simple, plugin-based parser for text

Latest version **1.3.3** (published 2021-11-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install know-parser
pnpm add know-parser
yarn add know-parser
bun add know-parser
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.3 |
| Published | 2021-11-18 |
| First published | 2019-09-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 44.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | George Meadows |
| Maintainers | implink |
| Keywords | data, email, language, parse, parser, parsing, phone, plugin, search, tagging |

## Links

- npm: https://www.npmjs.com/package/know-parser
- Repository: https://github.com/george-hm/know-parser
- Homepage: https://github.com/george-hm/know-parser/
- Issues: https://github.com/george-hm/know-parser/issues
- npm.io page: https://npm.io/package/know-parser

## Dependencies (1)

- [parse-domain](https://npm.io/package/parse-domain.md) ^2.3.2

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.3.3 (latest) — 2021-11-18
- 1.3.2 — 2021-05-15
- 1.3.1 — 2021-05-15
- 1.3.0 — 2021-05-15
- 1.2.13 — 2021-02-19
- 1.2.12 — 2020-08-17
- 1.2.11 — 2020-06-22
- 1.2.10 — 2020-01-10
- 1.2.9 — 2020-01-02
- 1.2.8 — 2019-12-04
- 1.2.7 — 2019-11-18
- 1.2.6 — 2019-11-14
- 1.2.5 — 2019-11-13
- 1.2.4 — 2019-11-08
- 1.2.3 — 2019-10-17
- … 14 more at https://npm.io/package/know-parser/versions

## README

# know-parser

[![](https://img.shields.io/npm/v/know-parser.svg)](https://www.npmjs.com/package/know-parser)
[![](https://img.shields.io/npm/dm/know-parser.svg)](https://www.npmjs.com/package/know-parser)
[![Coverage Status](https://coveralls.io/repos/github/george-hm/know-parser/badge.svg?branch=master)](https://coveralls.io/github/george-hm/know-parser?branch=master)

**Parses a piece of text to grab the most useful data**

know-parser is a JavaScript plugin-based package designed to extract useful data from a piece of text

This package comes bundled with a few pre-existing plugins to use right out of the box.
If you would like to create your own plugins, see `./PLUGIN_DEVELOPMENT.md`

This plugin was inspired by knwl.js

## Installation

`npm install --save know-parser`

## Usage Guide

### Example script

``` javascript
const parser = require("know-parser");
const knowParser = new parser("a bunch of words with an email: knowparser@implink.org");

const emails = knowParser.get("emails");
console.log(emails); // output: ["knowparser@implink.org"]
```

### Detailed walkthrough

1. Create a new instance of `know-parser`

    ```javascript
    const parser = require("know-parser");
    const knowParser = new parser();
    ```

2. Provide a piece of text to parse

    ``` javascript
    // string
    knowParser.lines = "this is a piece of text";

    // array
    knowParser.lines = ["an array", "of words"];

    // you can also provide lines via the constructor
    const knowParser = new parser("this is a piece of text");
    ```

3. Run a plugin on the piece of text

    ```javascript
    const emails = knowParser.get("emails");
    console.log(emails); // an array of email addresses
    ```

## Default Plugins

These are automatically loaded by default.

### emails

```javascript
const emails = knowParser.get("emails");
console.log(emails); // An array of email addresses
```

### phones

```javascript
const phones = knowParser.get('phones');
console.log(phones); // An array of phone numbers
```

### links

```javascript
const links = knowParser.get('links');
console.log(links); // An array of links (starting with http/https/www) e.g. "https://www.example.com"
```

You can also filter results like so:

```javascript
const links = knowParser.get('links', ['google.com'])
console.log(links) // An array of links including 'google.com'
```

### domains

```javascript
const domains = knowParser.get('domains');
console.log(domains); // an array of domains e.g. "example.com"
```

## Developing Parser Plugins

Because of the plugin-based nature of this package, it's surprisingly simple to create your own plugins for know-parser.
If you would like to contribute to/create a plugin please see `./PLUGIN_DEVELOPMENT.md`

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