You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
24 lines
606 B
TypeScript
24 lines
606 B
TypeScript
import { pushVerdictArguments } from './generic-transformers';
|
|
|
|
export const IS_READ_ONLY = true;
|
|
|
|
export function transformArguments(channels?: Array<string> | string): Array<string> {
|
|
const args = ['PUBSUB', 'NUMSUB'];
|
|
|
|
if (channels) {
|
|
pushVerdictArguments(args, channels);
|
|
}
|
|
|
|
return args;
|
|
}
|
|
|
|
export function transformReply(rawReply: Array<string | number>): Record<string, number> {
|
|
const transformedReply = Object.create(null);
|
|
|
|
for (let i = 0; i < rawReply.length; i +=2) {
|
|
transformedReply[rawReply[i]] = rawReply[i + 1];
|
|
}
|
|
|
|
return transformedReply;
|
|
}
|