Detalhes do pacote

@segment/fmt

segmentio66.6kSEE LICENSE IN LICENSE1.0.0

util.format-like string formatting utility

util, format, util-format, fmt

readme (leia-me)

fmt

CircleCI Codecov

util.format-like string format utility.

Installation

$ npm install @segment/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