Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 20x 20x 20x | // @flow
import filter from 'lodash/fp/filter'
import flow from 'lodash/fp/flow'
import isArray from 'lodash/isArray'
import isNil from 'lodash/fp/isNil'
import omitBy from 'lodash/fp/omitBy'
const filterArray = flow(filter((v) => !isNil(v)))
const filterObject = flow(omitBy(isNil))
/**
* removes nil values from arrays and nil `{key: value}` pairs from objects
*
* @function
* @param {Object|Array} value - the source object
* @return {Object|Array}
*/
export default (value) => (isArray(value))
? filterArray(value)
: filterObject(value)
|