MCPcopy Create free account
hub / github.com/cursor/cookbook / isModelSelection

Function isModelSelection

sdk/coding-agent-cli/src/tui/App.tsx:1150–1165  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

1148}
1149
1150function isModelSelection(value: unknown): value is ModelSelection {
1151 if (!hasStringProperty(value, "id")) {
1152 return false
1153 }
1154
1155 if (!("params" in value)) {
1156 return true
1157 }
1158
1159 const params = value.params
1160 return (
1161 params === undefined ||
1162 (Array.isArray(params) &&
1163 params.every((param) => hasStringProperty(param, "id") && hasStringProperty(param, "value")))
1164 )
1165}
1166
1167function hasStringProperty<K extends string>(value: unknown, key: K): value is Record<K, string> {
1168 if (typeof value !== "object" || value === null || !(key in value)) {

Callers 1

modelSelectionEqualsFunction · 0.85

Calls 1

hasStringPropertyFunction · 0.85

Tested by

no test coverage detected