Skip to content
This repository was archived by the owner on Oct 1, 2022. It is now read-only.

yangg/strbuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strbuf

Build Status Code Climate

Concat javascript string in es6 way, and more!

Usage

Given:

var json = {
  msg: "foo",
  info: { bar: 'hello'},
  list: [
    { name: 'a', date: '2016/7'},
    { name: 'b', date: '2016/8'},
  ]
};

Expect:

Using as a function

strbuf('hello, ${msg}, ${info.bar}', json);
strbuf('hello, {0}, {1}', 'foo', 'hello');

Using as a class

var html = new strbuf('<ul>');
html.push('<li>${msg}-${info.bar}</li>', json)
  .push('<li>{0}-{1}</li>', 'foo', 'hello');
html.pushArray('<li>${name} - ${date}</li>', json.list);
html.toString();

License

MIT

About

Concat javascript string in es6 way, and more!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors