Socket
Socket
Sign inDemoInstall

@blackglory/aho-corasick

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blackglory/aho-corasick

A simple Node.js wrapper for Rust's aho-corasick package


Version published
Maintainers
1
Created
Source

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-corasick

API

class AhoCorasick {
  constructor(
    patterns: string[]
  , options: { caseSensitive: boolean }
  )

  isMatch(text: string): boolean
  findAll(text: string): string[]
}

Benchmark

The patterns come from the title of the Chinese Wikipedia. The samples come from the text of the Chinese Wikipedia.

CompilationMatching
fastscan2351 op/s16.8 op/s
aho-corasick2348 op/s63.5 op/s

The results of the benchmark are relative values, which will change according to different patterns and samples.

Keywords

FAQs

Package last updated on 27 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc