bare-format
String formatting for JavaScript
Documented against
v1.0.2stable
bare-format — String formatting for JavaScript.
npm i bare-formatUsage
const format = require('bare-format')
format('Hello %s', 'world!')
// Hello world!API
Functions
format(...args: unknown[]): string
Formats args into a string, printf-style. If the first argument is a string containing %s, %d, %i, %f, %j, %o, %O, or %c placeholders, each is substituted with the corresponding argument; any remaining arguments are appended, space-separated, using bare-inspect for non-string values.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
args | unknown[] | — | An optional printf-style format string followed by the values to format. |
Returns string — The formatted string.
format.format(...args: unknown[]): string
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
args | unknown[] | — | — |
format.formatWithOptions(opts: {}, ...args: unknown[]): string
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
opts | {} | — | — |
args | unknown[] | — | — |
See also
- Builds on
bare-inspect. - Bare modules — the full
bare-*catalog. - Bare runtime API — the runtime these modules extend.