|
1 | | -# favr (development version) |
| 1 | +# favr 2.0.0 |
| 2 | + |
| 3 | +Refactor of the package to focus on function argument validation through "check" functions that throw an error if validation fails and return `NULL` (or occasionally the input) invisibly if validation succeeds. |
| 4 | + |
| 5 | +## New Features |
| 6 | + |
| 7 | +### General Validation |
| 8 | + |
| 9 | +* `abortif()` and `abortifnot()` functions to check conditions and error if a condition is `TRUE` or `FALSE`, respectively. |
| 10 | +* `check()` function to check conditions using tidy eval and error if a condition is `TRUE`. |
| 11 | +* `check_with()` function to check conditions in a data-masked context and error if a condition is `TRUE`. |
| 12 | +* `walk_check()` function to walk a predicate over a vector and error if any element fails the check. |
| 13 | + |
| 14 | +### Type and Class Validation |
| 15 | + |
| 16 | +* `check_inherits()` and `check_class()` functions to check the class of an object and error if it does not inherit from a specified class. |
| 17 | + |
| 18 | +### Type Validation |
| 19 | + |
| 20 | +* `check_list()`, `check_atomic()`, `check_vector()`, `check_integer()`, `check_double()`, `check_numeric()`, `check_character()`, `check_logical()`, `check_complex()`, `check_raw()`, `check_bytes()` and `check_null()` functions to check the type of an object and error if it does not match the specified type. |
| 21 | + |
| 22 | +* `check_scalar_list()`, `check_scalar_atomic()`, `check_scalar_vector()`, `check_scalar_integer()`, `check_scalar_double()`, `check_scalar_numeric()`, `check_scalar_character()`, `check_scalar_logical()`, `check_scalar_complex()`, `check_scalar_raw()` and `check_scalar_bytes()` functions to check if an object is a scalar of the specified type and error if it is not. |
| 23 | + |
| 24 | +* `check_array()`, `check_matrix()` and `check_table()` functions to check if an object is an array, matrix, or table, respectively, and error if it is not. |
| 25 | + |
| 26 | +### S3 Type Validation |
| 27 | + |
| 28 | +* `check_factor()`, `check_ordered()`, `check_date()`, `check_posixct()` and `check_posixlt()` functions to check if an object is of the specified S3 vector type and error if it is not. |
| 29 | + |
| 30 | +* `check_data_frame()`, `check_tibble()`, `check_data_table()` and `check_tidytable()` functions to check if an object is of the specified S3 data frame type and error if it is not. |
| 31 | + |
| 32 | +* `check_vctr()` and `check_list_of()` functions to check if an object is of the specified `vctrs` S3 type and error if it is not. |
| 33 | + |
| 34 | +* `s3_vec_check()` and `s3_df_check()` functions for developers to create their own S3 type checks for vector and data frame types, respectively. |
| 35 | + |
| 36 | +### Type Checking Modifiers |
| 37 | + |
| 38 | +* `bare()` modifier to check for bare objects (i.e. objects with no class attribute) in the type check functions, or bare S3 objects (where the expected S3 class is first in the class attribute vector) in the S3 type check functions. |
| 39 | + |
| 40 | +* `at_least()`, `at_most()`, and `in_range()` modifiers to check for ranges in length/number of rows/number of columns. |
| 41 | + |
| 42 | +### Scalar Value Validation |
| 43 | + |
| 44 | +* `check_true()`, `check_false()`, `check_bool()` and `check_string()` functions to check if an object is a scalar of the specified type and value and error if it is not. |
| 45 | + |
| 46 | +### Forbidden Values Validation |
| 47 | + |
| 48 | +* `check_no_na()`, `check_finite()` and `check_nzchar()` functions to check for the presence of forbidden values and error if found. |
| 49 | + |
| 50 | +### File and Directory Validation |
| 51 | + |
| 52 | +* `check_dir()` and `check_file()` functions to check if a directory or file exists and error if it does not. |
| 53 | +* `check_ext()` function to check the file extension of a file/path and error if it does not match the specified extensions. |
| 54 | + |
| 55 | +## Questioning |
| 56 | + |
| 57 | +Removed the online documentation for `enforce()`, `schema()`, `add_to_schema()`, `enforce_schema()`, and the associated casting and recycling helpers (`cast()`, `lossy()`, `recycle()` and `coerce()`). |
| 58 | + |
| 59 | +## Soft-Deprecated |
| 60 | + |
| 61 | +* `abort_if_not()` should be replaced with `abortifnot()` or `check()`. |
| 62 | +* `cast_if_not()` and `recycle_if_not()` should be replaced with their `vctrs` equivalents, `vctrs::vec_cast()` and `vctrs::vec_recycle()`, respectively. |
| 63 | +* All `are_*()` functions and the `have_names()` function - their use cases were limited and are easily replicated using `base::vapply()` and the associated predicate function. |
| 64 | + |
| 65 | +## Bug Fixes |
| 66 | + |
| 67 | +* Fixed a bug where `are_scalar_integerish()` would immediately error due to an erroneous `.n` argument. |
2 | 68 |
|
3 | 69 | # favr 1.0.0 |
4 | 70 |
|
|
0 commit comments