Created
March 23, 2019 10:07
-
-
Save Lcfvs/bfcb17ad3daeb69642f71728a8726bfb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Usage: | |
| * function fn([{a, b}, out], c) { | |
| * out.c = c | |
| * out.d = a + b + c | |
| * } | |
| * | |
| * const obj = {a: 1, b: 2} | |
| * io(fn, obj, 3) | |
| * console.log(obj) // obj = {a: 1, b: 2, c: 3, d: 6} | |
| */ | |
| export default function io (fn, input, ...args) { | |
| return fn.call(this, [input, input], ...args) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment