HN cut this off so I couldn't copy and paste it without opening developer tools. I can't find a way to put the code in a HN comment without breaking it, but you can go here and copy and paste:
This should work. Prefixed it with two spaces to trigger codeblock. If you double click to highlight and then copy, the app will automatically .trim() the input so the spaces should not matter.