Socket
Socket
Sign inDemoInstall

@coder-ka/parser-template

Package Overview
Dependencies
0
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @coder-ka/parser-template

parser generator in JavaScript.


Version published
Maintainers
1
Created

Readme

Source

Parser Template

Parser Template is a parser generator in JavaScript.

Installation

npm install @coder-ka/parser-template

Example

Creating an IPAddressV4 parser.

import { integer, seq } from "../lib/main";

const segment = integer();

const ipV4 = seq`${segment}.${segment}.${segment}.${segment}`;

const { value } = translate("192.168.1.1", ipV4);

// ["192","168","1","1"]
console.log(value);

A more complex example parsing markdown unordered list is here.

Structural Expressions

  • seq
  • flat
  • reduce
  • object

Control Expressions

  • lazy
  • or

Built-in Primitive Expressions

  • string
  • regexp
  • function(str: string): unknown
  • empty
  • end
  • any
  • exists
  • integer

Utility Expressions

  • repeat(at least 1)
  • split(delimiter, splitItemExpr)

FAQs

Last updated on 19 Oct 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