es2015/object-store/utils.js
function getFieldValue(object, fieldPath) {
  if (!fieldPath) {
    return object
  }

  let currentObject = object
  fieldPath.split(".").forEach((fieldName) => {
    if (!currentObject.hasOwnProperty(fieldName)) {
      throw new Error(`The field path ${fieldPath} does not exist in the ` +
          "provided object")
    }

    currentObject = currentObject[fieldName]
  })

  return currentObject
}
function getFieldValue(object, fieldPath) {
  if (!fieldPath) {
    return object
  }

  let currentObject = object
  fieldPath.split(".").forEach((fieldName) => {
    if (!currentObject.hasOwnProperty(fieldName)) {
      throw new Error(`The field path ${fieldPath} does not exist in the ` +
          "provided object")
    }

    currentObject = currentObject[fieldName]
  })

  return currentObject
}
Retrieves the value from the provided object at the specified field path.

@param {Object} object The object from which the field value is to be
extracted.
@param {string} fieldPath The path to the field to retrieve, specified as a
sequence of field names joined by dots ({@code "."}).
@return {*} The value of the specified field.
@throw {Error} Thrown if the field path does not exist in the provided
object.