diff --git a/snippets/over.md b/snippets/over.md new file mode 100644 index 000000000..ed2a1fedc --- /dev/null +++ b/snippets/over.md @@ -0,0 +1,14 @@ +### over + +Creates a function that invokes each provided function with the arguments it receives and returns the results. + +Use `Array.map()` and `Function.apply()` to apply each function to the given arguments. + +```js +const over = (...fns) => (...args) => fns.map(fn => fn.apply(null, args)); +``` + +```js +const minMax = over(Math.min, Math.max); +minMax(1,2,3,4,5); // [1,5] +``` diff --git a/tag_database b/tag_database index dbaec5875..8d46a58d6 100644 --- a/tag_database +++ b/tag_database @@ -147,6 +147,7 @@ on:browser,event once:function onUserInputChange:browser,event,advanced orderBy:object,array +over:adapter,function palindrome:string parseCookie:utility,string partition:array,object,function