MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / setItem

Function setItem

packages/react/src/components/json-schema-form.tsx:636–642  ·  view source on GitHub ↗
(index: number, next: unknown)

Source from the content-addressed store, hash-verified

634 const items = Array.isArray(value) ? value : [];
635
636 const setItem = (index: number, next: unknown): void => {
637 if (next === REMOVE) {
638 onChange(items.filter((_item: unknown, i: number) => i !== index));
639 return;
640 }
641 onChange(items.map((item: unknown, i: number) => (i === index ? next : item)));
642 };
643
644 return (
645 <div className="space-y-2 rounded-md border border-border/60 p-3">

Callers 1

ArrayFieldFunction · 0.85

Calls 1

onChangeFunction · 0.50

Tested by

no test coverage detected