Pattern Collector Line Extractor

A modular ES module to scan file contents and pull structured line details with capture variables using regular expressions.

Line Tracking Configurable Regex 3 Sub-Modules

๐Ÿ“– The Story Behind pattern-collector-anyjs-story

Imagine you have a large Express.js project with multiple versions, tables, and hundreds of API endpoints.

Every time you create a new API, you have to open several routing files and manually update them before your API becomes available.

๐Ÿ˜“ Manual Work

  • ๐Ÿ“ฅ Add a new import statement.
  • ๐Ÿ›ฃ๏ธ Add a new router.use() entry.
  • โšก Add a new router.get(), router.post(), router.put() or router.delete() method.
  • ๐Ÿ“ Find the correct location where the new code should be inserted.
  • ๐Ÿšซ Make sure duplicate routes are not created.
  • ๐Ÿงน Maintain proper formatting and file structure.

As your project grows, this process becomes repetitive, time-consuming, and increases the chance of making mistakes.


Installation

Add the pattern collector to your Node.js project using npm or yarn:

npm install pattern-collector-anyjs-story

Or using yarn:

yarn add pattern-collector-anyjs-story

Quick Start

Import the default function and pass your code text along with your configuration template name:

import collectPatternStory from 'pattern-collector-anyjs-story';

const results = collectPatternStory({
  fileContent: sourceCode,
  fileType: 'fromEndPointsJs'
});

Related Packages

This repository is built as a composition of modular sub-packages:

๐ŸŒŸ Why Developers Use This Repository

โœ… Automatic routing detection
โœ… Prevents duplicate code
โœ… Calculates insertion indexes
โœ… Maintains formatting
โœ… Faster API generation
โœ… Reusable across generators
โœ… Supports configurable Regex
โœ… Beginner Friendly