src/function/string/print.js
function _print (template, values, options) {
  return template.replace(/\$([\w.]+)/g, function (original, key) {
    const keys = key.split('.')
    let value = values[keys.shift()]
    while (keys.length && value !== undefined) {
      const k = keys.shift()
      value = k ? value[k] : value + '.'
    }

    if (value !== undefined) {
      if (!isString(value)) {
        return format(value, options)
      } else {
        return value
      }
    }

    return original
  }
  )
}
function _print (template, values, options) {
  return template.replace(/\$([\w.]+)/g, function (original, key) {
    const keys = key.split('.')
    let value = values[keys.shift()]
    while (keys.length && value !== undefined) {
      const k = keys.shift()
      value = k ? value[k] : value + '.'
    }

    if (value !== undefined) {
      if (!isString(value)) {
        return format(value, options)
      } else {
        return value
      }
    }

    return original
  }
  )
}
function _print ( template , values , options ) { return template . replace ( / \$([\w.]+) / g , function ( original , key ) { const keys = key . split ( '.' ) let value = values [ keys . shift ( ) ] while ( keys . length && value !== undefined ) { const k = keys . shift ( ) value = k ? value [ k ] : value + '.' } if ( value !== undefined ) { if ( ! isString ( value ) ) { return format ( value , options ) } else { return value } } return original } ) }
Interpolate values into a string template.
@param {string} template
@param {Object} values
@param {number | Object} [options]
@returns {string} Interpolated string
@private
Interpolate values into a string template .