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

Function optionalPositiveInteger

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

Source from the content-addressed store, hash-verified

76}
77
78export function optionalPositiveInteger(key: string): ParamCheck {
79 return (record) => {
80 const value = record[key]
81 if (value !== undefined && (typeof value !== "number" || !Number.isInteger(value) || value < 1)) {
82 return paramsError(`$.${key}`, `${key} must be a positive integer`)
83 }
84 return null
85 }
86}
87
88export function optionalStringArray(key: string): ParamCheck {
89 return (record) => {

Callers 1

Calls 1

paramsErrorFunction · 0.70

Tested by

no test coverage detected