A transducer implementation in JavaScript