Created
October 13, 2016 07:38
-
-
Save parro-it/be310f113c359647d1d84b6772667c7c 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
const slice = unthis(Array.prototype.slice) | |
console.log(slice(0, -1, [1,2,3])); | |
// <- [1,2] |
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
const unthis = method => (...args) => method.apply(args.slice(-1)[0], args.slice(0, -1)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment