Skip to content
This repository has been archived by the owner on Apr 4, 2019. It is now read-only.

yields/fmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fmt

string format utility

Installation

Install with component(1):

$ component install yields/fmt

Example

fmt('%d %s %o', '0n', 'str', {});
// => "0 str {}"

fmt.f = function(n){
  return Number(n || 0).toFixed(2);
};

fmt('floats: %f', 1);
// => "floats: 1.00"

API

fmt(str, ...)

Format the given str with ... args.

- `%o`: JSON.stringify
- `%d`: parseInt
- `%s`: String

License

MIT

About

tiny fmt utility

Resources

Stars

Watchers

Forks

Packages

No packages published