Created
March 1, 2018 15:20
-
-
Save fabe/418a10b08ae47282d5f34a599cd60627 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 objHasProps = (obj, props) => { | |
const check = props.map(prop => prop in obj) | |
return check.indexOf(false) === -1; | |
} | |
const obj = { a: 1, b: 2, c: 3 }; | |
if (objHasProps(obj, ['a', 'c'])) { | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment