Skip to content

Instantly share code, notes, and snippets.

@defims
Forked from jed/LICENSE.txt
Last active June 13, 2016 07:17
Show Gist options
  • Save defims/e63f76e65b05a8784a6b8a9fbceaf71d to your computer and use it in GitHub Desktop.
Save defims/e63f76e65b05a8784a6b8a9fbceaf71d to your computer and use it in GitHub Desktop.
bind functions cross-browser
function(
a, // the function to be bound
b, // (placeholder)
c // (placeholder)
){
b = [].slice.call( // cache the
arguments, 1 // original arguments
);
c = this; // and the context.
return function() { // return a function
b.unshift.apply( // that prepends the original arguments
arguments, b // to the current arguments, and
);
return a.apply( // calls the original function
c, arguments // with the original context and new arguments
)
}
}
export function(a,b,c){b=[].slice.call(arguments,1);c=this;return function(){b.unshift.apply(arguments,b);return a.apply(c,arguments)}}
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
{
"name": "bind",
"keywords": ["bind", "function", "functional", "curry"],
"version": "0.1.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment