Package Exports
- cli-sprintf-format
- cli-sprintf-format/get-modifiers
- cli-sprintf-format/get-modifiers.js
- cli-sprintf-format/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cli-sprintf-format) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
cli-sprintf-format
CLI dedicated sprintf formatter
An improved version of util.formatWithOptions
- Provides more reliable type resolution and error handling
- Detects color support (via supports-color)
- Ensures colored (if supported) output not only for the inspected objects but also for primitive vaulues
- Colored JSON (
%j
) formatting - Object inspection depth defaults to
4
, but can be overriden viaFORMAT_INSPECT_DEPTH
environment variable - For
%s
strings are passed throughinspect
formatter therefore appear colored (if supported) and eventual multiline content appears inline. To escape that behavior%#s
should be used instead
Installation
npm install cli-sprintf-format
Usage
const cliFormat = require("cli-sprintf-format");
console.log(cliFormat("Some %s with %d count", "foo", 12)); // Some foo with 12 count
Tests
npm test