MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / requiredPositiveInteger

Function requiredPositiveInteger

projects/runtime-node/src/validation.ts:70–76  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

68}
69
70export function requiredPositiveInteger(key: string): ParamCheck {
71 return (record) => {
72 const value = record[key]
73 if (typeof value !== "number" || !Number.isInteger(value) || value < 1) return paramsError(`$.${key}`, `${key} must be a positive integer`)
74 return null
75 }
76}
77
78export function optionalPositiveInteger(key: string): ParamCheck {
79 return (record) => {

Callers 2

Calls 1

paramsErrorFunction · 0.70

Tested by

no test coverage detected