Skip to content

Instantly share code, notes, and snippets.

@idettman
Created June 6, 2017 03:23
Show Gist options
  • Save idettman/c02c2c506abce106be03c1e64b7c9fc8 to your computer and use it in GitHub Desktop.
Save idettman/c02c2c506abce106be03c1e64b7c9fc8 to your computer and use it in GitHub Desktop.
JSON Utils
/**
* 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