reduce js to metaprogram