Skip to content

Instantly share code, notes, and snippets.

@graue
Created June 26, 2016 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save graue/6cfb0f764fae0c2f86941e7237a5fb4c to your computer and use it in GitHub Desktop.
Save graue/6cfb0f764fae0c2f86941e7237a5fb4c to your computer and use it in GitHub Desktop.
// from this
type SavedPlaylistItem = {
id: string,
checksum: number,
};
// generate this
function getSavedPlaylistItem(payload: Object): ?SavedPlaylistItem {
if (
typeof payload.id === 'string' &&
typeof payload.checksum === 'number'
) {
return {
id: payload.id,
checksum: payload.checksum,
};
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment