blob: 98c91ae6378b98e60ce76eed1b80eeccac7eff0e [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001var identity = require('./identity');
2
3/**
4 * Casts `value` to `identity` if it's not a function.
5 *
6 * @private
7 * @param {*} value The value to inspect.
8 * @returns {Function} Returns cast function.
9 */
10function castFunction(value) {
11 return typeof value == 'function' ? value : identity;
12}
13
14module.exports = castFunction;