This note is now live at https://chiubaca.com/using-javascript-to-write-postgresql-functions