UNPKG

@log4js2/core

Version:

log4js2 is a fast and lightweight logging library that enables logging flexibility within JavaScript/TypeScript applications, similar to Apache's [Log4j2 library](https://logging.apache.org/log4j/2.x/). It can also serve as a drop-in replacement for log4

31 lines (30 loc) 852 B
Object.defineProperty(exports, "__esModule", { value: true }); /** * Gets the function name of the specified function * * @function * @param {Function} func * * @returns {string} */ exports.getFunctionName = function (func) { if (func.name !== '') { return func.name; } else { // get the name of the function var name_1 = func.toString().substring('function '.length); name_1 = name_1.substring(0, name_1.indexOf('(')); // if the string is not empty return (name_1 && name_1.trim()) ? name_1 : 'anonymous'; } }; /** * Determines whether or not the value is an array. Return false is null * * @param {any} value * @returns {boolean} true if non-null array, else false */ exports.isArray = function (value) { return (typeof value === 'object' && value instanceof Array); };