MCPcopy Create free account
hub / github.com/simstudioai/sim / getLeafResourceSegment

Function getLeafResourceSegment

apps/sim/lib/copilot/tools/client/store-utils.ts:152–158  ·  view source on GitHub ↗
(segments: string[])

Source from the content-addressed store, hash-verified

150}
151
152function getLeafResourceSegment(segments: string[]): string {
153 const lastSegment = segments[segments.length - 1] || ''
154 if (hasFileExtension(lastSegment) && segments.length > 1) {
155 return segments[segments.length - 2] || lastSegment
156 }
157 return lastSegment
158}
159
160function hasFileExtension(value: string): boolean {
161 return /\.[^/.]+$/.test(value)

Callers 1

describeReadTargetFunction · 0.85

Calls 1

hasFileExtensionFunction · 0.85

Tested by

no test coverage detected