ts-logs
Version:
This package provide a skd for audit and manager logs in nodejs and express
33 lines • 968 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TagsFromBody = void 0;
const TagsFromBody = (body) => {
try {
if (body && typeof body === 'object' && !(body instanceof Date) && !(Array.isArray(body))) {
return Object.keys(body);
}
if (Array.isArray(body)) {
const result = [];
let i = 0;
while (body[i]) {
const val = body[i];
if (val && typeof val === 'string') {
result.push(val);
}
i++;
}
return result;
}
if (typeof body === 'string') {
const obj = JSON.parse(body);
return Object.keys(obj);
}
return [];
}
catch (error) {
return [];
}
};
exports.TagsFromBody = TagsFromBody;
exports.default = exports.TagsFromBody;
//# sourceMappingURL=get-tags-from-body.util.js.map