We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0a21d89 commit 5f92740Copy full SHA for 5f92740
src/utils/remove.js
@@ -0,0 +1,15 @@
1
+import _ from 'lodash'
2
+
3
+export const removeEmpty = (obj) => {
4
+ return _.transform(obj, function (result, value, key) {
5
+ if (!_.isEmpty(value) || _.isBoolean(value)) {
6
+ if (typeof value === 'object') {
7
+ result[key] = removeEmpty(value)
8
+ } else {
9
+ result[key] = value
10
+ }
11
+ } else if (_.isArray(value)) {
12
+ result[key] = []
13
14
+ })
15
+}
0 commit comments