Skip to content

kenvunz/shoelace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published