UNPKG

tsrpc-protocol

Version:
22 lines (21 loc) 702 B
"use strict"; exports.__esModule = true; var TsrpcPtl = /** @class */ (function () { /** * * @param filename Protocol file path, always assign `__filename` to it. * @param conf Custom protocol config, processed them later by yourself. */ function TsrpcPtl(filename, conf) { if (conf === void 0) { conf = {}; } this.filename = filename; var nameMatch = filename.match(/Ptl(\w+)\.[jt]s/); if (!nameMatch) { throw new Error('Invalid protocol filename, must with prefix `Ptl`'); } this.name = nameMatch[1]; this.conf = conf; } return TsrpcPtl; }()); exports["default"] = TsrpcPtl;