Skip to content

imnull/fmtstr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

string-format

Quick Start

import formatString from 'fmtstr'

let str = '{{{a}}}a{b}s{1}d{2:###},{3:[yyyy/MM/dd hh:mm:ss]}'

console.log(formatString(str, { a: '-a-', b: '-b-' }, '-num-', 5, new Date))

output

{-a-}a-b-s-num-d005,[2020/02/16 12:02:26]

Template Bucket

  • {key} the first param's key
  • {index} all params index

Data Fomatter

  • number ###.##
  • Date yyyy-MM-dd hh-mm-ss

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published