@21epub/epub-thirdparty
Version:
epub-thirdparty
24 lines (23 loc) • 828 B
JavaScript
/*---------------------------------------------------------------------------------------------
* 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 (let [id, service] of entries) {
this.set(id, service);
}
}
set(id, instanceOrDescriptor) {
const result = this._entries.get(id);
this._entries.set(id, instanceOrDescriptor);
return result;
}
has(id) {
return this._entries.has(id);
}
get(id) {
return this._entries.get(id);
}
}