New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

aca

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aca

Aho-Corasick automation for Node.js, Unicode Supported.

latest
npmnpm
Version
0.1.12
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

aca

The Aho–Corasick algorithm (aca) is a string searching algorithm.

$ npm i aca
const aca = require("aca");

aca.find(keywords: array, text: string, [charset: string])

Search for keywords in text strings.

charset (optional, Unicode or ASCII, defaults to Unicode)

aca.find(keywords, text) // => { matches, positions, count }

Example

var keywords = ["h", "he", "she", "hers", "his"];
var text = "ahishers";

var result = aca.find(keywords, text, 'ASCII');

result.matches //keyword:positions
=> {"h":[1,4],"his":[1],"she":[3],"he":[4],"hers":[4]} 
result.positions //position:keywords
=> [[1,["h","his"]],[3,["she"]],[4,["h","he","hers"]]]
result.count //keyword:count
=> {"h":2,"his":1,"he":1,"she":1,"hers":1}

aca.dict(keywords: string|buffer, text: string|buffer, [charset: string])

Coming soon.

keywords.txt one keyword per single line.

h
his
she
he
hers

text.txt

ahishers

Command line

Coming soon.

$ aca -v

Aho–Corasick algorithm wiki!

Keywords

Aho-Corasick automation

FAQs

Package last updated on 13 Nov 2017

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