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.
Param | Type | Description |
---|
f | string | Template. |
[...args] | * | Values. |
Example
var format = require('util-format-x');
format('%s:%s', 'foo');
format('%s:%s', 'foo', 'bar', 'baz');
format(1, 2, 3);
format('%% %s');