You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
23 lines
791 B
TypeScript
23 lines
791 B
TypeScript
import { RedisArgument, ArrayReply, TuplesReply, BlobStringReply, NullReply, UnwrapReply, Command } from '../RESP/types';
|
|
import { RedisVariadicArgument, pushVariadicArguments } from './generic-transformers';
|
|
|
|
export default {
|
|
FIRST_KEY_INDEX: 1,
|
|
IS_READ_ONLY: true,
|
|
transformArguments(
|
|
key: RedisArgument,
|
|
member: RedisVariadicArgument
|
|
) {
|
|
return pushVariadicArguments(['GEOPOS', key], member);
|
|
},
|
|
transformReply(reply: UnwrapReply<ArrayReply<TuplesReply<[BlobStringReply, BlobStringReply]> | NullReply>>) {
|
|
return reply.map(item => {
|
|
const unwrapped = item as unknown as UnwrapReply<typeof item>;
|
|
return unwrapped === null ? null : {
|
|
longitude: unwrapped[0],
|
|
latitude: unwrapped[1]
|
|
};
|
|
});
|
|
}
|
|
} as const satisfies Command;
|