LogoPear Docs

bare-format

String formatting for JavaScript

stable

bare-format — String formatting for JavaScript.

npm i bare-format

Usage

const format = require('bare-format')

format('Hello %s', 'world!')
// Hello world!

API

Functions

format(...args: unknown[]): string

Source

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

ParameterTypeDefaultDescription
argsunknown[]An optional printf-style format string followed by the values to format.

Returns string — The formatted string.

See also

On this page