nullSafe (source code)
- Curried: false
- Failsafe status: failsafe by default
The nullSafe
function takes a function as an argument and returns a curried version of the function. It ensures that the last argument passed to the curried function is not null or undefined before invoking the original function func
.
func
: A function that needs to be curried.
const add = (a, b) => a + b;
nullSafe(add)(1)(2);
// Output: 3