Socket
Socket
Sign inDemoInstall

@blackglory/aho-corasick

Package Overview
Dependencies
81
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

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
Weekly downloads
30
increased by2900%
Maintainers
1
Created
Weekly downloads
 

Changelog

Source

0.1.27 (2024-02-27)

Bug Fixes

  • rust: the generic type of DoubleArrayAhoCorasick (c92a1e9)

Readme

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

Last updated on 27 Feb 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc