Skip to content

Instantly share code, notes, and snippets.

@gyula-ny
Created February 6, 2019 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gyula-ny/5cad132824ead5fe47d3372ee7468069 to your computer and use it in GitHub Desktop.
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
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