src/getter.js
function getFlattenedDeps(getter, existing) {
  if (!existing) {
    existing = Immutable.Set()
  }

  const toAdd = Immutable.Set().withMutations(set => {
    if (!isGetter(getter)) {
      throw new Error('getFlattenedDeps must be passed a Getter')
    }

    getDeps(getter).forEach(dep => {
      if (isKeyPath(dep)) {
        set.add(List(dep))
      } else if (isGetter(dep)) {
        set.union(getFlattenedDeps(dep))
      } else {
        throw new Error('Invalid getter, each dependency must be a KeyPath or Getter')
      }
    })
  })

  return existing.union(toAdd)
}
function getFlattenedDeps(getter, existing) {
  if (!existing) {
    existing = Immutable.Set()
  }

  const toAdd = Immutable.Set().withMutations(set => {
    if (!isGetter(getter)) {
      throw new Error('getFlattenedDeps must be passed a Getter')
    }

    getDeps(getter).forEach(dep => {
      if (isKeyPath(dep)) {
        set.add(List(dep))
      } else if (isGetter(dep)) {
        set.union(getFlattenedDeps(dep))
      } else {
        throw new Error('Invalid getter, each dependency must be a KeyPath or Getter')
      }
    })
  })

  return existing.union(toAdd)
}
function getFlattenedDeps ( getter , existing ) { if ( ! existing ) { existing = Immutable . Set ( ) } const toAdd = Immutable . Set ( ) . withMutations ( set => { if ( ! isGetter ( getter ) ) { throw new Error ( 'getFlattenedDeps must be passed a Getter' ) } getDeps ( getter ) . forEach ( dep => { if ( isKeyPath ( dep ) ) { set . add ( List ( dep ) ) } else if ( isGetter ( dep ) ) { set . union ( getFlattenedDeps ( dep ) ) } else { throw new Error ( 'Invalid getter, each dependency must be a KeyPath or Getter' ) } } ) } ) return existing . union ( toAdd ) }
Returns an array of deps from a getter and all its deps
@param {Getter} getter
@param {Immutable.Set} existing
@return {Immutable.Set}
Returns an array of deps from a getter and all its deps