es2015/object-store/utils.js
function compileFieldGetter(fieldPath) {
  let fields = fieldPath.split(".")
  
  return (record) => {
    let value = record
    
    for (let field of fields) {
      if (!(value instanceof Object) || !value.hasOwnProperty(field)) {
        return undefined
      }
      
      value = value[field]
    }
    
    return value
  }
}
function compileFieldGetter(fieldPath) {
  let fields = fieldPath.split(".")
  
  return (record) => {
    let value = record
    
    for (let field of fields) {
      if (!(value instanceof Object) || !value.hasOwnProperty(field)) {
        return undefined
      }
      
      value = value[field]
    }
    
    return value
  }
}
function compileFieldGetter ( fieldPath ) { let fields = fieldPath . split ( "." ) return ( record ) => { let value = record for ( let field of fields ) { if ( ! ( value instanceof Object ) || ! value . hasOwnProperty ( field ) ) { return undefined } value = value [ field ] } return value } }
Compiles the provided field path to a function that retrieves the value of
the field denoted by the field path from the object passed to the function,
or {@code undefined} if the field does not exist in the object.

@param {string} fieldPath The field path to compile.
@return {function(*): *} The compiled field getter.
Compiles the provided field path to a function that retrieves the value of the field denoted by the field path from the object passed to the function or { @code undefined } if the field does not exist in the object .