Package Exports
- @blackglory/aho-corasick
- @blackglory/aho-corasick/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@blackglory/aho-corasick) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
aho-corasick
A simple Node.js wrapper for Rust's daachorse.
It's faster than the fastest pure JS implementation I know of, and it eats less memory.
Install
npm install --save @blackglory/aho-corasick
# or
yarn add @blackglory/aho-corasickAPI
class AhoCorasick {
constructor(
patterns: string[]
, options: { caseSensitive: boolean }
)
isMatch(text: string): boolean
findAll(text: string): string[]
}Benchmark
| Compilation | Matching | RSS | |
|---|---|---|---|
| daachorse(charwise) from crates | 17ms +4.74MB | 462ms +12.9MB | 73.4MB |
| fastscan(quick) from npm | 58ms +6.12MB | 1323ms +28.1MB | 89.4MB |