@kenvunz/shoelace

1.0.2 • Public • Published

Shoelace

A little utility that allow you to do this

Input:

import { parse } from "@kenvunz/shoelace";

const value = parse({
    foo: {
        baz: "baz",
        complex: ["1", "2"],
    },
    baz: "@{foo.baz}",
    complex: "@{foo.complex}"
});

Output:

{
    foo: {
        baz: 'baz',
        complex: ['1', '2']
    },
    baz: 'baz',
    complex: ['1', '2']
}

Features

  • Support complex but serialisable, e.g Array, Object
  • Support filters

Usage

Install:

yarn add @kenvunz/shoelace

Filters

Similar to other view template engine, filters are essentially functions that can be applied to variables. They are called with a pipe operator (|)

import { parser } from "@kenvunz/shoelace";

const parse = parser({
    lowercase(value) {
        return value.toLowerCase()
    }
});

const value = parse({
    foo: "Foo",
    baz: "@{foo | lowercase}"
});

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @kenvunz/shoelace

Weekly Downloads

0

Version

1.0.2

License

MIT

Last publish

Collaborators

  • kenvunz