proof of concept mapreduce in JS