Skip to content

Commit

Permalink
chore: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Jun 9, 2023
1 parent d02aa64 commit 77049fd
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/serializers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ const commandNameSerializer = (command: Commands): string => command
const splitCommandSerializer = (command: Commands): string => command.split(' ')[0]
const splitCommandKeywordSerializer = (command: Commands): string => command.split(' ')[1]

function customCommandNameSerializer(keyword: string) {
// Instead of using the command name, use a custom keyword
return (_command: Commands): string => keyword
}

const channelSerializer = (_command: Commands, { channel }: { channel: number }): string => channel + ''
const channelLayerSerializer = (_command: Commands, { channel, layer }: { channel: number; layer: number }): string =>
`${channel}-${layer}`
Expand Down Expand Up @@ -453,8 +448,8 @@ export const serializers: Readonly<Serializers<AMCPCommand>> = {
[Commands.Tls]: [commandNameSerializer, (_, { subDirectory }) => subDirectory ?? ''],
[Commands.Version]: [commandNameSerializer],
[Commands.Info]: [commandNameSerializer],
[Commands.InfoChannel]: [customCommandNameSerializer('INFO'), channelSerializer],
[Commands.InfoLayer]: [customCommandNameSerializer('INFO'), channelLayerSerializer],
[Commands.InfoChannel]: [splitCommandSerializer, channelSerializer],
[Commands.InfoLayer]: [splitCommandSerializer, channelLayerSerializer],
[Commands.InfoTemplate]: [commandNameSerializer, (_, { template }) => template],
[Commands.InfoConfig]: [commandNameSerializer],
[Commands.InfoPaths]: [commandNameSerializer],
Expand Down

0 comments on commit 77049fd

Please sign in to comment.