Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

util-format-x

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

util-format-x

An implementation of node's util.format

  • 1.3.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Travis status Dependency status devDependency status npm version

util-format-x

An implementation of node's util.format

Version: 1.3.0
Author: Xotic750 Xotic750@gmail.com
License: MIT
Copyright: Xotic750

module.exports*

The format() method returns a formatted string using the first argument as a printf-like format.

The first argument is a string containing zero or more placeholder tokens. Each placeholder token is replaced with the converted value from the corresponding argument. Supported placeholders are:

%s - String. %d - Number (integer or floating point value). %i - Integer. %f - Floating point value. %j - JSON. Replaced with the string '[Circular]' if the argument contains circular references. %% - single percent sign ('%'). This does not consume an argument.

Kind: Exported member
Returns: * - The target.

ParamTypeDescription
fstringTemplate.
[...args]*Values.

Example

var format = require('util-format-x');

// If the placeholder does not have a corresponding argument,
// the placeholder is not replaced.
format('%s:%s', 'foo'); // Returns: 'foo:%s'

// If there are more arguments passed to the format() method than the number
// of placeholders, the extra arguments are coerced into strings (for objects
// and symbols, inspect() is used) then concatenated to the returned
// string, each delimited by a space.
format('%s:%s', 'foo', 'bar', 'baz'); // 'foo:bar baz'

// If the first argument is not a format string then format() returns a
// string that is the concatenation of all arguments separated by spaces.
// Each argument is converted to a string using inspect().
format(1, 2, 3); // '1 2 3'

// If only one argument is passed to format(), it is returned as it is
//without any formatting.
format('%% %s'); // '%% %s'

Keywords

FAQs

Package last updated on 14 Jul 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc