Pattern Collector

A high-performance pattern collector and ESM import statement analyzer for JavaScript.

🚀 Zero Dependencies 🧩 Custom Regex Matching 📦 ESM Native 🔥 Pure JS

📦 Installation

Install the package into your project using npm or yarn:

npm install pattern-collector

Or yarn:

yarn add pattern-collector

🛠️ Basic Usage

Import and invoke the default function in your ES Modules:

import patternCollector from 'pattern-collector';

const matches = patternCollector({
  fileContent: codeText,
  searchString: /regex_pattern/g
});

🛠️ API Signature Reference

The default exported function accepts a single configuration object parameter:

patternCollector({ fileContent, searchString })
Parameter Type Description
fileContent string The raw file content text to scan.
searchString RegExp A global (/g) RegExp pattern to scan and collect.

📋 Code & Output Example

Click the button below to show a full static script execution example along with the console output results.

🎮 Live Playground

Input your source code and regular expression to see matched pattern results immediately inside the browser.

Matches Result
Indexed Matches
Click "Collect Patterns" to see results.