1.0.1 • Published 4 years ago

fmtstr v1.0.1

Weekly downloads
4
License
ISC
Repository
github
Last release
4 years ago

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