Checkout related packages
Install via npm:
$ npm install -g @bavary/lib
Install via yarn:
$ yarn global add @bavary/lib
Include directly via jsdelivr:
<script src="https://cdn.jsdelivr.net/npm/@bavary/lib/lib/bavary.lib.js"></script>
Usage
import {
/**
* Custom functions crafted for @bavary/core.
* Checkout the available-functions section for more info!
*/
functions,
/**
* Pass an array of function-names you want to use.
* Returns an object with functions.
*/
use
} from '@bavary/lib';
If you want to use these but have no idea how: checkout the documentation for how function work. You can even make custom ones!
Functions
Checkout the source if you want to now exactly whats going on in each function!
- ignore(...values) - Does nothing. Can be used to ignore the value of nested groups.
-
count(value, tag) - Saves the length of
value
(either array or string) intotag
. -
pick(value, property) - Extracts
property
fromvalue
and applies it as current result. - concat(a, b, tag?) _- Concatenates strings, arrays or objects.
-
expectEqual(msg | 'null', ...values) - Check whenever all values are equal. Returns false if first argument is
null
, otherwise the string is thrown as error. Returnsfalse
if at least one value isnull
. - defineProperty(tag, ...values) - Saves whatever is passed after the tag as property into the result. If more than one value is passed into it they're wrapped into an array.
-
deleteProperty(...props) - Deletes properties by their name in the current result.
If no tag is specified for objects and arrays the value will be appended to
a
(Via.push
orObject.assign
). Thetag
is mandatory for strings._
Related packages
- @bavary/core - Parser and compiler.
- @bavary/cli - CLI with development server.
- @bavary/lib - Standard library with extensions for bavary.