Files
lodash/_toSource.js
John-David Dalton ee6ec2f672 Bump to v4.8.0.
2016-04-04 14:22:57 -07:00

24 lines
526 B
JavaScript

var isFunction = require('./isFunction'),
toString = require('./toString');
/** Used to resolve the decompiled source of functions. */
var funcToString = Function.prototype.toString;
/**
* Converts `func` to its source code.
*
* @private
* @param {Function} func The function to process.
* @returns {string} Returns the source code.
*/
function toSource(func) {
if (isFunction(func)) {
try {
return funcToString.call(func);
} catch (e) {}
}
return toString(func);
}
module.exports = toSource;