Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@segment/fmt

segmentio52.7kSEE LICENSE IN LICENSE1.0.0

util.format-like string formatting utility

util, format, util-format, fmt

readme

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

changelog

1.0.0 / 2016-05-19

  • Remove Duo support, add Browserify support
  • Modernize test harness

0.1.0 / 2014-09-26

  • add JSON.stringify fallback
  • test: Fix extensible assertion [stephenmathieson]

0.0.2 / 2013-12-11

  • dev deps (typo)

0.0.1 / 2013-12-11

  • Initial commit