You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
326 B

4 years ago
  1. var identity = require('./identity');
  2. /**
  3. * Casts `value` to `identity` if it's not a function.
  4. *
  5. * @private
  6. * @param {*} value The value to inspect.
  7. * @returns {Function} Returns cast function.
  8. */
  9. function castFunction(value) {
  10. return typeof value == 'function' ? value : identity;
  11. }
  12. module.exports = castFunction;