Skip to content

Commit

Permalink
fix GET and GET_BUFFER return type
Browse files Browse the repository at this point in the history
  • Loading branch information
leibale committed Sep 13, 2021
1 parent 08837c8 commit 9fc08d4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/commands/GET.ts
@@ -1,5 +1,5 @@
import { TransformArgumentsReply } from '.';
import { transformReplyString } from './generic-transformers';
import { transformReplyStringNull } from './generic-transformers';

export const FIRST_KEY_INDEX = 1;

Expand All @@ -9,4 +9,4 @@ export function transformArguments(key: string | Buffer): TransformArgumentsRepl
return ['GET', key];
}

export const transformReply = transformReplyString;
export const transformReply = transformReplyStringNull;
4 changes: 2 additions & 2 deletions lib/commands/GET_BUFFER.ts
@@ -1,7 +1,7 @@
import { transformReplyBuffer } from './generic-transformers';
import { transformReplyBufferNull } from './generic-transformers';

export { FIRST_KEY_INDEX, IS_READ_ONLY, transformArguments } from './GET';

export const BUFFER_MODE = true;

export const transformReply = transformReplyBuffer;
export const transformReply = transformReplyBufferNull;
8 changes: 4 additions & 4 deletions lib/commands/generic-transformers.ts
Expand Up @@ -20,10 +20,6 @@ export function transformReplyString(reply: string): string {
return reply;
}

export function transformReplyBuffer(reply: Buffer): Buffer {
return reply;
}

export function transformReplyStringNull(reply: string | null): string | null {
return reply;
}
Expand Down Expand Up @@ -54,6 +50,10 @@ export function transformReplyBit(reply: BitValue): BitValue {
return reply;
}

export function transformReplyBufferNull(reply: Buffer | null): Buffer | null {
return reply;
}

export function transformReplyVoid(): void {}

export interface ScanOptions {
Expand Down

0 comments on commit 9fc08d4

Please sign in to comment.