auto curry in JavaScript