lib/utils.js
function get_associated_collections(collection) {
  const map = new Map()

  get_association_keys(collection)
    // Return the identity to the related resource.
    .forEach(key => {
      // Get the attributes
      const collection_attributes = collection._attributes[key]

      // Most of the time, it's a one to one
      // relationship so it's not an array.
      let is_array = false

      // But sometimes, it's a one to many
      // so array must be true.
      if (collection_attributes.hasOwnProperty("collection")) {
        is_array = true
      }

      // Set the values.
      map.set(key, { is_array, collection })
    })

  return map
}
function get_associated_collections(collection) {
  const map = new Map()

  get_association_keys(collection)
    // Return the identity to the related resource.
    .forEach(key => {
      // Get the attributes
      const collection_attributes = collection._attributes[key]

      // Most of the time, it's a one to one
      // relationship so it's not an array.
      let is_array = false

      // But sometimes, it's a one to many
      // so array must be true.
      if (collection_attributes.hasOwnProperty("collection")) {
        is_array = true
      }

      // Set the values.
      map.set(key, { is_array, collection })
    })

  return map
}
function get_associated_collections ( collection ) { const map = new Map ( ) get_association_keys ( collection ) // Return the identity to the related resource. . forEach ( key => { // Get the attributes const collection_attributes = collection . _attributes [ key ] // Most of the time, it's a one to one // relationship so it's not an array. let is_array = false // But sometimes, it's a one to many // so array must be true. if ( collection_attributes . hasOwnProperty ( "collection" ) ) { is_array = true } // Set the values. map . set ( key , { is_array , collection } ) } ) return map }
Get the collections assigned to each association
within the collection.
@param  {Waterline.Collection} collection to get associations from.
@return {Map} Map of the collections that have `model|collection` properties and their type.
Get the collections assigned to each association within the collection .