Skip to content

Files

Latest commit

315780a · Jan 24, 2018

History

History
13 lines (9 loc) · 280 Bytes

unary.md

File metadata and controls

13 lines (9 loc) · 280 Bytes

unary

Creates a function that accepts up to one argument, ignoring any additional arguments.

Call the provided function, fn, with just the first argument given.

const unary = fn => val => fn(val);
['6', '8', '10'].map(unary(parseInt)); // [6, 8, 10]