MCPcopy Index your code
hub / github.com/simstudioai/sim / parseOptionalNumber

Function parseOptionalNumber

apps/sim/lib/copilot/tools/handlers/vfs.ts:216–223  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

214
215 try {
216 const parseOptionalNumber = (value: unknown): number | undefined => {
217 if (typeof value === 'number' && Number.isFinite(value)) return value
218 if (typeof value === 'string' && value.trim() !== '') {
219 const parsed = Number.parseInt(value, 10)
220 return Number.isFinite(parsed) ? parsed : undefined
221 }
222 return undefined
223 }
224 const offset = parseOptionalNumber(params.offset)
225 const limit = parseOptionalNumber(params.limit)
226 const applyWindow = <T extends { content: string; totalLines: number }>(result: T): T => {

Callers 1

executeVfsReadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected