MCPcopy
hub / github.com/redis/node-redis / parseCommand

Function parseCommand

packages/client/lib/commands/HSET.ts:21–37  ·  view source on GitHub ↗
(parser: CommandParser, ...[key, value, fieldValue]: SingleFieldArguments | MultipleFieldsArguments)

Source from the content-addressed store, hash-verified

19
20export default {
21 parseCommand(parser: CommandParser, ...[key, value, fieldValue]: SingleFieldArguments | MultipleFieldsArguments) {
22 parser.push('HSET');
23 parser.pushKey(key);
24
25 if (typeof value === 'string' || typeof value === 'number' || value instanceof Buffer) {
26 parser.push(
27 convertValue(value),
28 convertValue(fieldValue!)
29 );
30 } else if (value instanceof Map) {
31 pushMap(parser, value);
32 } else if (Array.isArray(value)) {
33 pushTuples(parser, value);
34 } else {
35 pushObject(parser, value);
36 }
37 },
38 transformReply: undefined as unknown as () => NumberReply
39} as const satisfies Command;
40

Callers

nothing calls this directly

Calls 6

pushKeyMethod · 0.80
convertValueFunction · 0.70
pushMapFunction · 0.70
pushTuplesFunction · 0.70
pushObjectFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected