MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / getNodeName

Function getNodeName

packages/debugger/src/main/utils.ts:113–145  ·  view source on GitHub ↗
(o: {
    component?: ((..._: any) => any) & {displayName?: string},
    name?:      string,
})

Source from the content-addressed store, hash-verified

111}
112
113export const getNodeName = (o: {
114 component?: ((..._: any) => any) & {displayName?: string},
115 name?: string,
116}): string | undefined => {
117
118 let name: string | undefined
119
120 search: {
121 if (typeof o.component === 'function' &&
122 typeof o.component.displayName === 'string' &&
123 o.component.displayName.length > 0
124 ) {
125 name = o.component.displayName
126 break search
127 }
128 /* solid.devComponent already assigns o.component.name to o.name */
129
130 if (o.name != null && o.name.length > 0) {
131 name = o.name
132 break search
133 }
134
135 return undefined
136 }
137
138 if (name.startsWith(SOLID_REFRESH_PREFIX)) {
139 name = name.slice(SOLID_REFRESH_PREFIX.length)
140 }
141
142 name = trimString(name, 36)
143
144 return name
145}
146
147export function markOwnerType(o: Solid.Owner): NodeType {
148 if (o.sdtType !== undefined) return o.sdtType

Callers 6

mapOwnerFunction · 0.90
addNodeToGraphFunction · 0.90
getNodeStateFunction · 0.90
getNodeStateWithValueFunction · 0.90
logOwnersDiffFunction · 0.90
logOwnerListFunction · 0.90

Calls 1

trimStringFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…