Skip to content

Latest commit

 

History

History
66 lines (49 loc) · 948 Bytes

README.md

File metadata and controls

66 lines (49 loc) · 948 Bytes

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