1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-04 15:02:09 +03:00
Files
node-redis/packages/client/lib/commands/LCS_IDX_WITHMATCHLEN.ts
Bobby I. 20c16e0c2c (docs) add jsdoc comments to command parsers (#2984)
* (docs) bloom: add jsdocs for all commands

* (docs) json: add jsdocs

* (docs) search: add jsdocs for all commands

* (docs) jsdocs for std commands

* (docs) jsdoc comments to time series commands
2025-06-03 14:38:07 +03:00

38 lines
1.1 KiB
TypeScript

import { TuplesToMapReply, BlobStringReply, ArrayReply, TuplesReply, NumberReply, UnwrapReply, Resp2Reply, Command } from '../RESP/types';
import LCS_IDX, { LcsIdxRange } from './LCS_IDX';
export type LcsIdxWithMatchLenMatches = ArrayReply<
TuplesReply<[
key1: LcsIdxRange,
key2: LcsIdxRange,
len: NumberReply
]>
>;
export type LcsIdxWithMatchLenReply = TuplesToMapReply<[
[BlobStringReply<'matches'>, LcsIdxWithMatchLenMatches],
[BlobStringReply<'len'>, NumberReply]
]>;
export default {
IS_READ_ONLY: LCS_IDX.IS_READ_ONLY,
/**
* Constructs the LCS command with IDX and WITHMATCHLEN options
*
* @param args - The same parameters as LCS_IDX command
* @see https://redis.io/commands/lcs/
*/
parseCommand(...args: Parameters<typeof LCS_IDX.parseCommand>) {
const parser = args[0];
LCS_IDX.parseCommand(...args);
parser.push('WITHMATCHLEN');
},
transformReply: {
2: (reply: UnwrapReply<Resp2Reply<LcsIdxWithMatchLenReply>>) => ({
matches: reply[1],
len: reply[3]
}),
3: undefined as unknown as () => LcsIdxWithMatchLenReply
}
} as const satisfies Command;