Concepts

Trust boundary

Try the free JavaScript compiler

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 rejection

Working Example

Example Snippetjavascript
(async () => {const qty=x=>Number.isInteger(x)&&x>=0&&x<=20?x:null;console.log(qty(0),qty("3"),qty(21));})()
JavaScript Reference