Socket
Socket
Sign inDemoInstall

@eslint-community/regexpp

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eslint-community/regexpp

Regular expression parser for ECMAScript.


Version published
Weekly downloads
28M
decreased by-3.31%
Maintainers
0
Weekly downloads
 
Created

What is @eslint-community/regexpp?

@eslint-community/regexpp is a utility library for parsing, analyzing, and transforming regular expressions. It is particularly useful for developers who need to work with regular expressions in a programmatic way, such as in linting tools, code editors, or other development tools.

What are @eslint-community/regexpp's main functionalities?

Parsing Regular Expressions

This feature allows you to parse a regular expression string into an Abstract Syntax Tree (AST). The AST can then be analyzed or transformed as needed.

const { parseRegExpLiteral } = require('@eslint-community/regexpp');
const ast = parseRegExpLiteral('/abc/');
console.log(JSON.stringify(ast, null, 2));

Validating Regular Expressions

This feature allows you to validate a regular expression string. If the regex is invalid, an error will be thrown, which can be caught and handled.

const { validateRegExpLiteral } = require('@eslint-community/regexpp');
try {
  validateRegExpLiteral('/abc/');
  console.log('Valid regex');
} catch (e) {
  console.error('Invalid regex', e.message);
}

Traversing AST

This feature allows you to traverse the AST of a regular expression. You can define visitor functions that will be called for specific types of nodes in the AST.

const { parseRegExpLiteral, visitRegExpAST } = require('@eslint-community/regexpp');
const ast = parseRegExpLiteral('/abc/');
visitRegExpAST(ast, {
  onCharacterClassEnter(node) {
    console.log('Character class:', node);
  }
});

Other packages similar to @eslint-community/regexpp

Keywords

FAQs

Package last updated on 14 Sep 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