GitHub 6248★

Create a function that accepts a single argument

JavaScript version

const unary = (fn) => (arg) => fn(arg);

Examples

['1', '2', '3', '4', '5'].map(unary(parseInt)); // [1, 2, 3, 4, 5]
Follow me on and to get more useful contents.