UNPKG

monaco-editor-core

Version:

A browser based code editor

21 lines (20 loc) 772 B
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ export class ServiceCollection { constructor(...entries) { this._entries = new Map(); for (const [id, service] of entries) { this.set(id, service); } } set(id, instanceOrDescriptor) { const result = this._entries.get(id); this._entries.set(id, instanceOrDescriptor); return result; } get(id) { return this._entries.get(id); } }