Created
December 16, 2016 01:27
-
-
Save Kosmin/531ed135a1adc644117548f9fed4e2ff to your computer and use it in GitHub Desktop.
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
// This comes in handy whenever we want to uniquely identify JSON objects on the client side | |
// - works with ImmutableJS objects or ES6 Maps | |
export default (object) => { | |
if (object.get) { | |
return `${object.get('type')}_${object.get('id')}`; | |
} | |
return `${object.type}_${object.id}`; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment