moleculer-decorators
Version:
decorators for moleculer
31 lines (30 loc) • 892 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function getTag(value) {
if (value == null) {
return value === undefined ? '[object Undefined]' : '[object Null]';
}
return toString.call(value);
}
function isObject(value) {
const type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
function omit(object, remove) {
let newObj = Object.assign({}, object);
for (let n of remove)
delete newObj[n];
return newObj;
}
exports.omit = omit;
function isFunction(value) {
if (!isObject(value)) {
return false;
}
const tag = getTag(value);
return (tag == '[object Function]' ||
tag == '[object AsyncFunction]' ||
tag == '[object GeneratorFunction]' ||
tag == '[object Proxy]');
}
exports.isFunction = isFunction;