src/util.js
function hasNestedProperty(obj, propertyPath, returnVal = false) {
  if (!propertyPath) return false;

  // strip the leading dot
  propertyPath = propertyPath.replace(/^\./, '');
  const properties = propertyPath.split('.');

  for (var i = 0; i < properties.length; i++) {
    var prop = properties[i];

    if (!obj || !obj.hasOwnProperty(prop)) {
      return returnVal ? null : false;
    } else {
      obj = obj[prop];
    }
  }

  return returnVal ? obj : true;
}
function hasNestedProperty(obj, propertyPath, returnVal = false) {
  if (!propertyPath) return false;

  // strip the leading dot
  propertyPath = propertyPath.replace(/^\./, '');
  const properties = propertyPath.split('.');

  for (var i = 0; i < properties.length; i++) {
    var prop = properties[i];

    if (!obj || !obj.hasOwnProperty(prop)) {
      return returnVal ? null : false;
    } else {
      obj = obj[prop];
    }
  }

  return returnVal ? obj : true;
}
function hasNestedProperty ( obj , propertyPath , returnVal = false ) { if ( ! propertyPath ) return false ; // strip the leading dot propertyPath = propertyPath . replace ( / ^\. / , '' ) ; const properties = propertyPath . split ( '.' ) ; for ( var i = 0 ; i < properties . length ; i ++ ) { var prop = properties [ i ] ; if ( ! obj || ! obj . hasOwnProperty ( prop ) ) { return returnVal ? null : false ; } else { obj = obj [ prop ] ; } } return returnVal ? obj : true ; }
Checks to see whether an object has a deeply nested path
@param {Object} target
@param {String} propertyPath
@param {Boolean} returnVal
@returns {Boolean || Any} will return either true/false for existance or the actual value
Checks to see whether an object has a deeply nested path