import { HALConfig } from '../hal.config'; import { OrganizationConverter } from './organization.converter'; import { OrganizationCollection } from './organization.collection'; export class OrganizationCollectionConverter { public constructor(private coverter: OrganizationConverter) {} public toCollection(json: any): OrganizationCollection { const collection: OrganizationCollection = new OrganizationCollection(); if (json[HALConfig.embedded] && json[HALConfig.embedded]['organizations']) { collection.organizations = this.coverter.toMany(json[HALConfig.embedded]['organizations']); } return collection; } }