1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00
Files
node-redis/packages/client/lib/commands/ZPOPMIN.ts
Leibale 2b318d4100 WIP
2023-06-22 18:18:23 -04:00

28 lines
718 B
TypeScript

import { RedisArgument, TuplesReply, BlobStringReply, DoubleReply, Command } from '../RESP/types';
export default {
FIRST_KEY_INDEX: 1,
IS_READ_ONLY: false,
transformArguments(key: RedisArgument) {
return ['ZPOPMIN', key];
},
transformReply: {
2: (reply: TuplesReply<[]> | TuplesReply<[BlobStringReply, BlobStringReply]>) => {
if (reply.length === 0) return null;
return {
value: reply[0],
score: Number(reply[1])
};
},
3: (reply: TuplesReply<[]> | TuplesReply<[BlobStringReply, DoubleReply]>) => {
if (reply.length === 0) return null;
return {
value: reply[0],
score: reply[1]
};
}
}
} as const satisfies Command;