Socket
Socket
Sign inDemoInstall

cli-sprintf-format

Package Overview
Dependencies
18
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cli-sprintf-format

sprintf formatting targetted for CLI


Version published
Weekly downloads
907K
decreased by-3.48%
Maintainers
1
Install size
1.03 MB
Created
Weekly downloads
 

Changelog

Source

1.1.1 (2021-12-21)

Bug Fixes

  • Ensure same literals output in Node.js v12+ versions (835ff8f)

Maintenance Improvements

  • Upgrade cli-color to v2 (94a420f)
  • Upgrade supports-color to v6 (0d68980)

<a name="1.1.0"></a>

Readme

Source

Build status Tests coverage npm version

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 via FORMAT_INSPECT_DEPTH environment variable
  • For %s strings are passed through inspect 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

Keywords

FAQs

Last updated on 21 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc