node-gamedig/lib/ProtocolResolver.js

8 lines
238 B
JavaScript
Raw Normal View History

import * as protocols from '../protocols/index.js'
export const getProtocol = (protocolId) => {
if (!(protocolId in protocols)) { throw Error('Protocol definition file missing: ' + protocolId) }
return new protocols[protocolId]()
}