Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bavary/core

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bavary/core

Customizable, elegant and fast syntax-parser

  • 0.0.26
  • Source
  • npm
  • Socket score

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

Logo


gzip size brotli size Coverage Status Build Status Download count Current version Support me

Checkout related packages

Getting Started

⚠ Bavary is currently not stable and heavily under development. The API might change and all 0.0.x releases should be treated as test / preview releases.

Install via npm:

$ npm install @bavary/core

Install via yarn:

$ yarn add @bavary/core

Include directly via jsdelivr:

<script src="https://cdn.jsdelivr.net/npm/@bavary/core/lib/bavary.js"></script>

Usage

import {compile} from '@bavary/core';

// Compile definitions
const parse = compile(`['A' | 'B']`);

// Use compiled definitions to parse a string
const parsed = parse('A');

// Logs "A" to the console
console.log(parsed);

The function compile accepts as second argument a config object.

Compiling in chunks

It's possible to (re-)compile just parts of your entire code-base to speed up the process:

import {compile, compileChunk,} from '@bavary/core';
const entry = compileChunk(`entry [<abc>]`);
const abc = compileChunk(`<abc> = [(a - c)+]`);
const parse = compile([...entry, ...abc]);

console.log(parse('aabbccc')); // Prints 'aabbccc'

What's next?

Check out the documentation to get started or jump directly into one of the examples:

  1. string - Parsing strings and support escaped quotes.
  2. hex-color - Parsing different kinds of color types in the hexadecimal format.
  3. number - Parsing floats and integers with optional scientific notation.

Keywords

FAQs

Package last updated on 29 Jan 2020

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