MCPcopy Create free account
hub / github.com/dailydotdev/apps / updateCode

Function updateCode

packages/shared/src/components/fields/CodeField.tsx:32–43  ·  view source on GitHub ↗
(value: string, index: number)

Source from the content-addressed store, hash-verified

30 );
31
32 const updateCode = (value: string, index: number) => {
33 const newCode = [...code];
34 newCode[index] = value;
35 setCode(newCode);
36 onChange?.(newCode.join(''));
37
38 const finalCode = newCode.join('');
39
40 if (finalCode.length === length && index === length - 1) {
41 onSubmit(finalCode);
42 }
43 };
44
45 const onSlice = (text: string) => {
46 const sliced = text.slice(0, length);

Callers 1

onKeyDownFunction · 0.85

Calls 2

onChangeFunction · 0.70
onSubmitFunction · 0.50

Tested by

no test coverage detected