0.1.0 • Published 2 years ago

@sangl/formatter v0.1.0

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
2 years ago

sangl-formatter

This package provides a formatter for strings in which variables are replaced by a key-value map.

Central point is that there can be a format defined, which specifies how the variable is displayed. For example an UUID which specified a production task can be replaced by the article/serial number so it is human-friendly.

Usage

import {format} from "sangl-formatter"
import {useClient} from "./somehwere/else"

let client = useClient() // Define client

format(
    client,
    "{productionTaskId:productionTask}",
    {
        productionTaskId: "9a65ea53-f792-4029-a9cf-99c799623bef"
    }
).then(result => console.log(result))