Skip to main content
Glama
defaultmap.ts398 B
export class DefaultMap<K, V> extends Map<K, V> { constructor( private getDefaultValue: (key: K) => V, entries?: readonly (readonly [K, V])[] | null, ) { super(entries); } get = (key: K): V => { if (!this.has(key)) { this.set(key, this.getDefaultValue(key)); } /* eslint-disable @typescript-eslint/no-non-null-assertion */ return super.get(key)!; }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/systeminit/si'

If you have feedback or need assistance with the MCP directory API, please join our Discord server