0.0.27 • Published 4 years ago

@bavary/core v0.0.27

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

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.

Related packages

0.0.27

4 years ago

0.0.26

4 years ago

0.0.25

4 years ago

0.0.24

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago