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 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 804x 803x 803x 4721x 1733x 803x 4730x 33x 4697x 1x 1x 1x | /**
* take an object of key values, it keeps only truthy values depending on
* the predicate function passed
*/
export function customPickBy(obj: any, func: (v: any) => boolean) {
if (!obj) return undefined;
let objectCopy = Object.assign({}, obj);
Object.keys(objectCopy).forEach(key => {
if (!func(objectCopy[key])) {
delete objectCopy[key]
}
});
return objectCopy;
}
export function customIdentity(value: any) {
/**
* allow 0 values to exist and convert them to string
*/
if (typeof value == 'number' && value == 0)
return '0';
// if (typeof value == 'string' && value == '')
// return true;
return value;
}
export function skipEmptyObject(item: any) {
switch (typeof item) {
case 'object': {
Eif (Object.keys(item).length)
return true;
else
return false;
}
default: return true;
}
} |