# js-keyword

> js-keyword could help you search tag in a brunch of tags

Latest version **1.1.3** (published 2018-02-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install js-keyword
pnpm add js-keyword
yarn add js-keyword
bun add js-keyword
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2018-02-24 |
| First published | 2016-11-28 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 26.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Rijn |
| Maintainers | rijn |

## Links

- npm: https://www.npmjs.com/package/js-keyword
- Repository: https://rijn@github.com/rijn/jsKeyword
- Homepage: https://github.com/rijn/jsKeyword#readme
- Issues: https://github.com/rijn/jsKeyword/issues
- npm.io page: https://npm.io/package/js-keyword

## Dependencies (1)

- [require](https://npm.io/package/require.md) ^2.4.20

## Recent versions

- 1.1.3 (latest) — 2018-02-24
- 1.1.2 — 2016-11-28
- 1.1.1 — 2016-11-28
- 1.1.0 — 2016-11-28

## README

# jsKeyword

* jsKeyword provide you a easy way to find a string from long text or thousands of tags by fuzzy query.
* jsKeyword 可以从大量标签中迅速进行模糊检索，或从超长文本中检索标签，轻松实现搜索和自动完成功能。

[![npm version](https://badge.fury.io/js/js-keyword.svg)](https://badge.fury.io/js/js-keyword)

## Demo

[http://lab.rijnx.com/jsKeyword/](http://lab.rijnx.com/jsKeyword/) 

## Install

```
npm install --save js-keyword
```

## Usage

### Require Module

```
var keyword = require('js-keyword');
```

### Push Keywords

`Push` will exclude duplicated data automatically. It will return number of successful push.

```
keyword.push(["a", "b", "c", ...]);
keyword.push("a", "b", "c", ...);       // { count: 1 }
```

### Remove

```
keyword.remove(["a", "b", "c", ...]);
keyword.remove("a", "b", "c", ...);
```

### Check

`Check` whether the keyword is in the pool.

```
keyword.check(["a", "b", "c", ...]);
keyword.check("a", "b", "c", ...);
```

It will return a boolean array of existence.

```
[true, false, true, ...]
```

### Search

Use `Search` to find the keyword in a long content. It is like `indexOf` but is much faster.

```
keyword.search("this is a test text.");
```

If succeed, it will return the position of keyword.

```
[
    {
        keyword: "keyword",
        position: {
            start: xxx,
            end:   xxx,
        },
    },
    {
        keyword: "keyword",
        position: {
            start: xxx,
            end:   xxx,
        },
    },
    ...
]
```

### autoComplete

It will return all the keywords which include the input string.

```
keyword.autoComplete(input);
```

Will return an array of string.

```
["keyword", "keyword", ...]
```

## Screenshots

![](http://lab.rijnx.com/jsKeyword/image/1.png)
![](http://lab.rijnx.com/jsKeyword/image/2.png)

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