mirror of
https://github.com/strapi/strapi.git
synced 2025-07-27 19:10:01 +00:00
16 lines
358 B
JavaScript
16 lines
358 B
JavaScript
'use strict';
|
|
|
|
const _ = require('lodash');
|
|
|
|
const removeUndefined = (obj) => _.pickBy(obj, (value) => typeof value !== 'undefined');
|
|
|
|
const keysDeep = (obj, path = []) =>
|
|
!_.isObject(obj)
|
|
? path.join('.')
|
|
: _.reduce(obj, (acc, next, key) => _.concat(acc, keysDeep(next, [...path, key])), []);
|
|
|
|
module.exports = {
|
|
removeUndefined,
|
|
keysDeep,
|
|
};
|