Created
September 26, 2018 05:08
-
-
Save kitsune7/b65b31e149dd7d3e330fa0ceeff2e558 to your computer and use it in GitHub Desktop.
A function that checks whether or not a JSON object has all the properties that were passed to it.
This file contains hidden or 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
/** | |
* @param object json | |
* @param string[] properties | |
* @returns boolean | |
*/ | |
function jsonHasProperties (json, properties) { | |
return properties.every(prop => json.hasOwnProperty(prop)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment