Skip to content

Instantly share code, notes, and snippets.

@Kosmin
Created December 16, 2016 01:27
Show Gist options
  • Save Kosmin/531ed135a1adc644117548f9fed4e2ff to your computer and use it in GitHub Desktop.
Save Kosmin/531ed135a1adc644117548f9fed4e2ff to your computer and use it in GitHub Desktop.
// 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