1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-03 04:01:40 +03:00
Files
node-redis/packages/client/lib/commands/CONFIG_SET.ts
Avital Fine c5c2bf9042 Support multiple parametrs on CONFIG SET (#2042)
* support multiple parametrs on CONFIG SET

* clean code

Co-authored-by: leibale <leibale1998@gmail.com>
2022-03-20 13:40:27 -04:00

24 lines
726 B
TypeScript

import { RedisCommandArgument, RedisCommandArguments } from '.';
type SingleParameter = [parameter: RedisCommandArgument, value: RedisCommandArgument];
type MultipleParameters = [config: Record<string, RedisCommandArgument>];
export function transformArguments(
...[parameterOrConfig, value]: SingleParameter | MultipleParameters
): RedisCommandArguments {
const args: RedisCommandArguments = ['CONFIG', 'SET'];
if (typeof parameterOrConfig === 'string') {
args.push(parameterOrConfig, value!);
} else {
for (const [key, value] of Object.entries(parameterOrConfig)) {
args.push(key, value);
}
}
return args;
}
export declare function transformReply(): string;