MCPcopy Create free account
hub / github.com/ShipSecAI/studio / canCoercePrimitive

Function canCoercePrimitive

frontend/src/utils/portUtils.ts:51–68  ·  view source on GitHub ↗
(
  source: Extract<ConnectionType, { kind: 'primitive' }>,
  target: Extract<ConnectionType, { kind: 'primitive' }>,
)

Source from the content-addressed store, hash-verified

49 dataType?.kind === 'contract';
50
51const canCoercePrimitive = (
52 source: Extract<ConnectionType, { kind: 'primitive' }>,
53 target: Extract<ConnectionType, { kind: 'primitive' }>,
54): boolean => {
55 if (source.name === target.name) {
56 return true;
57 }
58 if (target.name === 'text' && (source.name === 'number' || source.name === 'boolean')) {
59 return true;
60 }
61 if (target.name === 'number' && source.name === 'text') {
62 return true;
63 }
64 if (target.name === 'boolean' && source.name === 'text') {
65 return true;
66 }
67 return false;
68};
69
70const comparePortTypes = (source: ConnectionType, target: ConnectionType): boolean => {
71 if (target.kind === 'any' || source.kind === 'any') {

Callers 1

comparePortTypesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected