_castFunction.js 326 B

1234567891011121314
  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;