MCPcopy Index your code
hub / github.com/codeaashu/claude-code / parsePositiveIntFromFrontmatter

Function parsePositiveIntFromFrontmatter

src/utils/frontmatterParser.ts:275–289  ·  view source on GitHub ↗
(
  value: unknown,
)

Source from the content-addressed store, hash-verified

273 * @returns The parsed positive integer, or undefined if invalid or not provided
274 */
275export function parsePositiveIntFromFrontmatter(
276 value: unknown,
277): number | undefined {
278 if (value === undefined || value === null) {
279 return undefined
280 }
281
282 const parsed = typeof value === 'number' ? value : parseInt(String(value), 10)
283
284 if (Number.isInteger(parsed) && parsed > 0) {
285 return parsed
286 }
287
288 return undefined
289}
290
291/**
292 * Validate and coerce a description value from frontmatter.

Callers 2

parseAgentFromMarkdownFunction · 0.85
loadAgentFromFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected