MCPcopy Create free account
hub / github.com/chhoumann/quickadd / insertIntoMulti

Function insertIntoMulti

src/services/packageImportService.ts:1008–1018  ·  view source on GitHub ↗
(parent: IMultiChoice, child: IChoice)

Source from the content-addressed store, hash-verified

1006}
1007
1008function insertIntoMulti(parent: IMultiChoice, child: IChoice): void {
1009 if (!Array.isArray(parent.choices)) {
1010 parent.choices = [];
1011 }
1012 const idx = parent.choices.findIndex((choice) => choice.id === child.id);
1013 if (idx !== -1) {
1014 parent.choices.splice(idx, 1, child);
1015 } else {
1016 parent.choices.push(child);
1017 }
1018}
1019
1020function findMultiByPath(
1021 rootChoices: IChoice[],

Callers 2

applyPackageImportFunction · 0.70
insertUnderParentFunction · 0.70

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected