mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 09:27:49 +00:00
Bump to v4.9.0.
This commit is contained in:
10
_toSource.js
10
_toSource.js
@@ -1,6 +1,3 @@
|
||||
var isFunction = require('./isFunction'),
|
||||
toString = require('./toString');
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var funcToString = Function.prototype.toString;
|
||||
|
||||
@@ -12,12 +9,15 @@ var funcToString = Function.prototype.toString;
|
||||
* @returns {string} Returns the source code.
|
||||
*/
|
||||
function toSource(func) {
|
||||
if (isFunction(func)) {
|
||||
if (func != null) {
|
||||
try {
|
||||
return funcToString.call(func);
|
||||
} catch (e) {}
|
||||
try {
|
||||
return (func + '');
|
||||
} catch (e) {}
|
||||
}
|
||||
return toString(func);
|
||||
return '';
|
||||
}
|
||||
|
||||
module.exports = toSource;
|
||||
|
||||
Reference in New Issue
Block a user