UNPKG

canonical

Version:

Canonical code style linter and formatter for JavaScript, SCSS, CSS and JSON.

15 lines (12 loc) 318 B
var identity = require('../identity'); /** * Converts `value` to a function if it's not one. * * @private * @param {*} value The value to process. * @returns {Function} Returns the function. */ function toFunction(value) { return typeof value == 'function' ? value : identity; } module.exports = toFunction;