Created
December 6, 2017 18:56
-
-
Save matthewrobb/75ce4990d654ad7f0191852320003dcf to your computer and use it in GitHub Desktop.
This file contains 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
'use strict'; | |
export function free(fn) { | |
return function() { | |
return this === undefined ? fn.apply(undefined, arguments) : fn.call(undefined, this, ...arguments); | |
} | |
} | |
export function freeRight(fn) { | |
return function() { | |
return this === undefined ? fn.apply(undefined, arguments) : fn.call(undefined, ...arguments, this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment