decl: Type-check a function parameter

View source: R/declare.R

declR Documentation

Type-check a function parameter

Description

Stops if variable type is wrong.

Usage

decl(x, pred)

Arguments

`x`

Variable to be type-checked

`pred`

A type checking predicate, such as is.character or is.data.frame (function)

Details

decl is a simple, fast type checker, which is nice when speed matters, such as in low-level functions.

Value

decl returns its first argument, but halts on type errors.


pteetor/tutils documentation built on March 29, 2025, 6:38 p.m.