diff --git a/snippets/unary.md b/snippets/unary.md new file mode 100644 index 000000000..51fa353cc --- /dev/null +++ b/snippets/unary.md @@ -0,0 +1,13 @@ +### 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. + +```js +const unary = fn => val => fn(val); +``` + +```js +['6', '8', '10'].map(unary(parseInt)); // [6, 8, 10] +``` diff --git a/tag_database b/tag_database index 32328d8a5..e942ec1e5 100644 --- a/tag_database +++ b/tag_database @@ -221,6 +221,7 @@ toSnakeCase:string,regexp transform:object,array truncateString:string truthCheckCollection:object,logic,array +unary:adaptor,function unescapeHTML:string,browser union:array,math unionBy:array,function