Concepts
Trust boundary
A design boundary where untrusted input is converted to a restricted domain value; authorization is separate.
Formal Syntax & Structure
javascript syntaxjavascript
validate(raw) → domain value or rejectionWorking Example
Example Snippetjavascript
(async () => {const qty=x=>Number.isInteger(x)&&x>=0&&x<=20?x:null;console.log(qty(0),qty("3"),qty(21));})()