Created
June 6, 2017 03:23
-
-
Save idettman/c02c2c506abce106be03c1e64b7c9fc8 to your computer and use it in GitHub Desktop.
JSON Utils
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
/** | |
* Check for equality between two objects based on JSON stringification | |
* @param {Object} objectA | |
* @param {Object} objectB | |
*/ | |
export const jsonStringifyEquality = (objectA, objectB) => { | |
return JSON.stringify(objectA) === JSON.stringify(objectB); | |
} | |
/** | |
* Clone the object using Javscript's JSON API | |
* @param {Object} object | |
*/ | |
export const jsonCloneObject = (object) => { | |
return JSON.parse(JSON.stringify(object)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment