UNPKG

deadem

Version:

JavaScript (Node.js & Browsers) parser for Deadlock (Valve Source 2 Engine) demo/replay files

30 lines (25 loc) 559 B
class Serializable { /** * @public * @abstract */ constructor() { const DerivedClass = this.constructor; if (typeof DerivedClass.deserialize !== 'function') { throw new Error(`${DerivedClass.name} must implement static method deserialize()`); } } /** * @public */ serialize() { return this._serialize(); } /** * @protected */ _serialize() { throw new Error('serialize() method is not implemented'); } } export default Serializable;