src/validators-constructor.js
function formatStr(str, values) {
    values = values || {};

    if (typeof str !== 'string') {
        return str;
    }

    return str.replace(FORMAT_REGEXP, (m0, m1, m2) => (m1 === '%' ? "%{" + m2 + "}" : values[m2]));
}
function formatStr(str, values) {
    values = values || {};

    if (typeof str !== 'string') {
        return str;
    }

    return str.replace(FORMAT_REGEXP, (m0, m1, m2) => (m1 === '%' ? "%{" + m2 + "}" : values[m2]));
}
function formatStr ( str , values ) { values = values || { } ; if ( typeof str !== 'string' ) { return str ; } return str . replace ( FORMAT_REGEXP , ( m0 , m1 , m2 ) => ( m1 === '%' ? "%{" + m2 + "}" : values [ m2 ] ) ) ; }
Format string with patterns

@param {String} str ("I'm %{age} years old")
@param {Object} [values] ({age: 21})

@returns {String} formatted string ("I'm 21 years old")
Format string with patterns