Does the input contain a boolean flag?

isFlag(x, .xname = getNameInParent(x))

Arguments

x

Object.

.xname

Name of object defined in x. Not intended to be used directly.

Value

TRUE on success; FALSE on failure, with cause set.

Note

Updated 2019-08-10.

Examples

## TRUE ==== isFlag(TRUE)
#> [1] TRUE
isFlag(FALSE)
#> [1] TRUE
## FALSE ==== isFlag(c(TRUE, TRUE))
#> [1] FALSE #> Cause: 'c(TRUE, TRUE)' is not a boolean flag (TRUE/FALSE).
isFlag(1)
#> [1] FALSE #> Cause: '1' is not a boolean flag (TRUE/FALSE).
isFlag(NA)
#> [1] FALSE #> Cause: 'NA' is NA.