Skip to content

Instantly share code, notes, and snippets.

@sirmews
Created April 25, 2020 21:58
Show Gist options
  • Save sirmews/943b721d247881e8398b27ce9e04d7d9 to your computer and use it in GitHub Desktop.
Save sirmews/943b721d247881e8398b27ce9e04d7d9 to your computer and use it in GitHub Desktop.
const doNecessaryKeysExist = (obj) => {
const neededKeys = ['GID', 'day_part', 'day']
let expectedTrueValues = neededKeys.length
let trueValues = neededKeys.reduce((a, prop) => {
return a + (prop in obj && obj[prop] !== null)
}, 0);
return expectedTrueValues === trueValues
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment