Skip to content

dpjanes/iotdb-format

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iotdb-format

Yet another bloody module: simple, somewhat powerful, string formatting

This isn't really finished: it needs a proper grammar, maybe using JISON.

Format Strings

const iotdb_format = require('iotdb-format')
const d = {
    message: "Hello, World"
}

iotdb_format.format("{{ message }}") // "Hello World"
iotdb_format.format("{{ message|upper }}") // "HELLO WORLD"
iotdb_format.format("{{ xmessage|:Something Else }}") // "Something Else"
iotdb_format.format("{{ xmessage|:Something Else|lower }}") // "something else"

Format Objects

const iotdb_format = require('iotdb-format')
const d = {
    msg: {
        hello: "Hello",
        world: "World",
    }
}

iotdb_format.format({
    list: [ "{{ msg/hello }}", "{{ msg/comma|:, }}", "{{ msg/world|upper }}", 3.14 ]
}, d)

// result: { list: [ 'Hello', ',', 'WORLD', 3.14 ] }

About

Yet another bloody module: simple, somewhat powerful, string formatting

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published