function messageFromBundle(bundle, errors, message, args) {
  const formatted = {
    value: null,
    attributes: null,
  };

  if (message.value) {
    formatted.value = bundle.formatPattern(message.value, args, errors);
  }

  let attrNames = Object.keys(message.attributes);
  if (attrNames.length > 0) {
    formatted.attributes = new Array(attrNames.length);
    for (let [i, name] of attrNames.entries()) {
      let value = bundle.formatPattern(message.attributes[name], args, errors);
      formatted.attributes[i] = { name, value };
    }
  }

  return formatted;
}
Format all public values of a message into a {value, attributes} object.

This function is passed as a method to `keysFromBundle` and resolve
a single L10n Entity using provided `FluentBundle`.

The function will return an object with a value and attributes of the
entity.

@param   {FluentBundle} bundle
@param   {Array<Error>} errors
@param   {Object} message
@param   {Object} args
@returns {Object}
@private