valaddin-package: valaddin: Functional Input Validation

valaddin-packageR Documentation

valaddin: Functional Input Validation

Description

valaddin provides a functional operator, firmly, that enhances functions with input validation. You supply a function f along with input validation requirements, and firmly returns a function that applies f “firmly”: before a call to f is attempted, its inputs are checked, and if any check fails, an error halts further execution with a message tabulating every failing check. Because firmly implements input validation by operating on whole functions rather than values, it is suitable for both programming and interactive use.

Using firmly to add input validation to your functions improves the legibility, reusability, and reliability of your code:

  • Emphasize the core logic of your functions by excising validation boilerplate.

  • Reduce duplication by reusing common checks across functions with common input requirements.

  • Make function outputs more predictable by constraining their inputs.

  • Vary the strictness of a function according to need and circumstance.

Details

For an example-oriented overview of valaddin, see vignette("valaddin").

Author(s)

Maintainer: Eugene Ha eha@posteo.de

See Also

Useful links:


egnha/valaddin documentation built on Nov. 3, 2023, 5:27 p.m.