Socket
Socket
Sign inDemoInstall

pegjs-override-action

Package Overview
Dependencies
1
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pegjs-override-action

Override action (PEGjs plugin)


Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

PEGjs override action

Override action (PEGjs plugin)

Reason

This plugin came to life as part of a process of referencing basic PEGs and build structure outside of the PEGs. In essence, it gives the possibility for reusable PEGs.

E.g. A collection of core PEGjs grammars (RFC, ISO, etc.)

Usage

npm install pegjs-override-action

See index.example1.test.js and a convenient function .makeBuildParser in index.example2.test.js.

Scopes and require paths

When defining an action as a function, it will be stringified and injected into a different scope, which breaks variable closure.

Any data or functions that need to be shared between rule actions should be defined in your initializer block.

When using require in your actions or initializer, it is a good idea to resolve an absolute path (e.g. using require.resolve as the code is also executed in a different path than where it is defined.

License

UNLICENSE

FAQs

Last updated on 06 Mar 2022

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