Created
June 26, 2016 20:49
-
-
Save graue/6cfb0f764fae0c2f86941e7237a5fb4c to your computer and use it in GitHub Desktop.
This file contains 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
// 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