fmtstr

1.0.1 • Public • Published

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

Package Sidebar

Install

npm i fmtstr

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

12.5 kB

Total Files

8

Last publish

Collaborators

  • imnull