Created
April 25, 2020 21:58
-
-
Save sirmews/943b721d247881e8398b27ce9e04d7d9 to your computer and use it in GitHub Desktop.
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 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