Created
February 6, 2019 10:02
-
-
Save gyula-ny/5cad132824ead5fe47d3372ee7468069 to your computer and use it in GitHub Desktop.
check whether all fields of an object that are arrays are empty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hasOnlyEmptyArrFields = obj => { | |
return Object.keys(obj).filter(key => Array.isArray(obj[key])) | |
.reduce((result, incoming) => { | |
return result && obj[incoming].length === 0 | |
}, true) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment