Validate a natural number
The raw input
isNaturalNumber(1) >> { valid: true, parsed: 1, }; isNaturalNumber(0) >> { valid: false, error: "Not a natural number: 0", }; Copy
isNaturalNumber(1) >> { valid: true, parsed: 1, }; isNaturalNumber(0) >> { valid: false, error: "Not a natural number: 0", };
Validate a natural number