Prompt
Model the server-side gate of an OTA system like EAS Update. Given:
binary = { runtimeVersion, channel }— what the installed app reportsupdates = [{ id, runtimeVersion, channel, createdAt }]— published updates (createdAt is a number)
Write selectUpdate(updates, binary):
- An update is compatible only if BOTH
runtimeVersionandchannelmatch the binary exactly - Return the newest compatible update (highest createdAt), or
nullif none
Hints
Solution
Your Code
15 min