You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
fix #1707 - handle number arguments in legacy mode
This commit is contained in:
@@ -113,3 +113,18 @@ export function transformCommandReply(
|
||||
|
||||
return command.transformReply(rawReply, preserved);
|
||||
}
|
||||
|
||||
export type LegacyCommandArguments = Array<string | number | Buffer | LegacyCommandArguments>;
|
||||
|
||||
export function transformLegacyCommandArguments(args: LegacyCommandArguments, flat: RedisCommandArguments = []): RedisCommandArguments {
|
||||
for (const arg of args) {
|
||||
if (Array.isArray(arg)) {
|
||||
transformLegacyCommandArguments(arg, flat);
|
||||
continue;
|
||||
}
|
||||
|
||||
flat.push(typeof arg === 'number' ? arg.toString() : arg);
|
||||
}
|
||||
|
||||
return flat;
|
||||
}
|
||||
|
Reference in New Issue
Block a user