diff options
Diffstat (limited to 'node_modules/mongoose/lib/helpers/getFunctionName.js')
-rw-r--r-- | node_modules/mongoose/lib/helpers/getFunctionName.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/node_modules/mongoose/lib/helpers/getFunctionName.js b/node_modules/mongoose/lib/helpers/getFunctionName.js new file mode 100644 index 0000000..87a2c69 --- /dev/null +++ b/node_modules/mongoose/lib/helpers/getFunctionName.js @@ -0,0 +1,8 @@ +'use strict'; + +module.exports = function(fn) { + if (fn.name) { + return fn.name; + } + return (fn.toString().trim().match(/^function\s*([^\s(]+)/) || [])[1]; +}; |