ensure: Ensure checks that certain preconditions and postconditions...

Description Usage Arguments Value Examples

View source: R/ensure.R

Description

Ensure checks that certain preconditions and postconditions of a function are true.

Usage

1

Arguments

checker_fn

function. A function to run with validated pre- and postconditions.

preconditions

list. A list of preconditions to check.

postconditions

list. A list of postconditions to check.

Value

The original function, but also of class validated_function, with added validations.

Examples

1
2
3
  add <- ensure(pre = list(x %is% numeric, y %is% numeric),
    post = list(result %is% numeric),
    function(x, y) { x + y })

peterhurford/checkr documentation built on May 25, 2019, 1:50 a.m.