1
0
Fork 0
mirror of https://github.com/demostf/demo.js synced 2026-06-04 09:04:13 +02:00

minor cleanup

This commit is contained in:
Robin Appelman 2017-09-03 14:10:47 +02:00
commit 2c8fe681d3
9 changed files with 93 additions and 54 deletions

View file

@ -1,6 +1,6 @@
import {BitStream} from 'bit-buffer';
import {Match} from '../../Data/Match';
import {Packet, PacketType, VoidPacket} from '../../Data/Packet';
import {Packet, VoidPacket} from '../../Data/Packet';
export type Parser<P extends Packet> = (stream: BitStream, match?: Match, skip?: boolean) => P;
export type Encoder<P extends Packet> = (packet: P, stream: BitStream, match?: Match) => void;

View file

@ -1,8 +1,8 @@
import {Packet} from '../../Data/Packet';
import {Packet, PacketType} from '../../Data/Packet';
import {Encoder, PacketHandler, Parser} from './Parser';
import {BitStream} from 'bit-buffer';
export function make<P extends Packet>(name: P['packetType'], definition: string): PacketHandler<P> {
export function make<P extends Packet>(name: PacketType, definition: string): PacketHandler<P> {
const parts = definition.split('}');
const items = parts.map((part) => {
return part.split('{');