Autocurry in JS