UNPKG

voca

Version:

The ultimate JavaScript string library

42 lines (38 loc) 1.42 kB
import './internal/is_nil.js'; import './is_string.js'; import './internal/coerce_to_string.js'; import './internal/const.js'; import { n as nilDefault } from './internal/nil_default.js'; import './internal/to_string.js'; import './internal/coerce_to_number.js'; import './internal/to_integer.js'; import './truncate.js'; import sprintf from './sprintf.js'; import './repeat.js'; import './internal/build_padding.js'; import './pad_left.js'; import './pad_right.js'; import { _ as _toConsumableArray } from './internal/_rollupPluginBabelHelpers.js'; /** * Produces a string according to `format`. Works exactly like <a href="#sprintf"><code>sprintf()</code></a>, * with the only difference that accepts the formatting arguments in an array `values`.<br/> * See <a href="#sprintf-format">here</a> `format` string specifications. * * @function vprintf * @static * @since 1.0.0 * @memberOf Format * @param {string} format=''] The format string. * @param {Array} replacements The array of replacements to produce the string. * @return {string} Returns the produced string. * @example * v.vprintf('%s', ['Welcome']) * // => 'Welcome' * * v.vprintf('%s has %d apples', ['Alexandra', 3]); * // => 'Alexandra has 3 apples' */ function vprintf(format, replacements) { return sprintf.apply(void 0, [format].concat(_toConsumableArray(nilDefault(replacements, [])))); } export default vprintf;