addon/components/array-container.js
function clearSubObject (object, path, pathIndex) {
  const key = path[pathIndex]
  if (path.length < pathIndex + 2) {
    delete object[key]
    return true
  }
  const subObj = object[key]
  const didClear = clearSubObject(subObj, path, pathIndex + 1)
  if (didClear && keys(subObj).length <= 0) {
    delete object[key]
    return true
  }
  return false
}
function clearSubObject (object, path, pathIndex) {
  const key = path[pathIndex]
  if (path.length < pathIndex + 2) {
    delete object[key]
    return true
  }
  const subObj = object[key]
  const didClear = clearSubObject(subObj, path, pathIndex + 1)
  if (didClear && keys(subObj).length <= 0) {
    delete object[key]
    return true
  }
  return false
}
function clearSubObject ( object , path , pathIndex ) { const key = path [ pathIndex ] if ( path . length < pathIndex + 2 ) { delete object [ key ] return true } const subObj = object [ key ] const didClear = clearSubObject ( subObj , path , pathIndex + 1 ) if ( didClear && keys ( subObj ) . length <= 0 ) { delete object [ key ] return true } return false }
Recursively clears empty objects based on a path

@param {Object} object Hash containing object
@param {String[]} path Array of path segments to the desired value to clear
@param {Number} pathIndex Index of the path segment to use as a key
@returns {Boolean} True if a key was deleted from the passed in object
Recursively clears empty objects based on a path