mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Bump to v4.8.0.
This commit is contained in:
23
_toSource.js
Normal file
23
_toSource.js
Normal file
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user