UNPKG

@nestjs/graphql

Version:

GraphQL for NestJS: code-first and schema-first APIs, resolvers as providers, subscriptions, federation and generated SDL, on Apollo or Mercurius.

27 lines (26 loc) • 648 B
export class MetadataByNameCollection { constructor() { this.internalCollection = new Map(); this.all = []; } getAll() { return [...this.all]; } getByName(name) { return this.internalCollection.get(name); } add(value, name) { if (this.internalCollection.has(name)) { return; } this.internalCollection.set(name, value); this.all.push(value); } unshift(value, name) { if (this.internalCollection.has(name)) { return; } this.internalCollection.set(name, value); this.all.unshift(value); } }