Rename js snippets

This commit is contained in:
Angelos Chalaris
2023-05-19 20:23:47 +03:00
parent 82a614e42e
commit 9d032ce05e
305 changed files with 70 additions and 70 deletions

View File

@ -0,0 +1,21 @@
---
title: Invoke functions on arguments
type: snippet
language: javascript
tags: [function]
cover: armchair-in-yellow
dateModified: 2020-10-21T21:54:53+03:00
---
Creates a function that invokes each provided function with the arguments it receives and returns the results.
- Use `Array.prototype.map()` and `Function.prototype.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]
```