Skip to content

Commit

Permalink
Check for closures by type, explicitly (#18)
Browse files Browse the repository at this point in the history
In purrr 0.2.3, is_function() returns TRUE for primitive functions.
  • Loading branch information
egnha committed Aug 10, 2017
1 parent 21473d1 commit 4eb5894
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/checkers.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ chkrs <- do.call("c", unname(chkrs_))
chkrs$vld_numeric <- localize(ff_new(is.numeric, "Not double/integer"))
chkrs$vld_scalar_numeric <- localize(ff_new(
quote({is.numeric(.) && length(.) == 1L}), "Not scalar double/integer"))
chkrs$vld_closure <- localize(ff_new(purrr::is_function, "Not closure"))
chkrs$vld_closure <- localize(ff_new(
quote({typeof(.) == "closure"}), "Not closure"))
chkrs$vld_true <- localize(ff_new(is_true, "Not TRUE"))
chkrs$vld_false <- localize(ff_new(is_false, "Not FALSE"))
chkrs$vld_all <- localize(ff_new(all, "Not all TRUE"))
Expand Down

0 comments on commit 4eb5894

Please sign in to comment.