You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
28 lines
731 B
TypeScript
28 lines
731 B
TypeScript
import { RedisArgument, TuplesReply, BlobStringReply, DoubleReply, UnwrapReply, Command } from '../RESP/types';
|
|
|
|
export default {
|
|
FIRST_KEY_INDEX: 1,
|
|
IS_READ_ONLY: false,
|
|
transformArguments(key: RedisArgument) {
|
|
return ['ZPOPMAX', key];
|
|
},
|
|
transformReply: {
|
|
2: (reply: UnwrapReply<TuplesReply<[] | [BlobStringReply, BlobStringReply]>>) => {
|
|
if (reply.length === 0) return null;
|
|
|
|
return {
|
|
value: reply[0],
|
|
score: Number(reply[1])
|
|
};
|
|
},
|
|
3: (reply: UnwrapReply<TuplesReply<[] | [BlobStringReply, DoubleReply]>>) => {
|
|
if (reply.length === 0) return null;
|
|
|
|
return {
|
|
value: reply[0],
|
|
score: reply[1]
|
|
};
|
|
}
|
|
}
|
|
} as const satisfies Command;
|