Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Created August 26, 2012 10:27
Show Gist options
  • Select an option

  • Save hughfdjackson/3477008 to your computer and use it in GitHub Desktop.

Select an option

Save hughfdjackson/3477008 to your computer and use it in GitHub Desktop.
var bundle = function(){
var fns = [].slice.call(arguments)
return function(){
var args = [].slice.call(arguments)
fns.forEach(function(fn){ fn.apply(null, args) })
}
}
var f1 = function(a, b){ console.log(a + b) }
, f2 = function(a, b){ console.log(a * b) }
, fns= bundle(f1, f2)
fns(1, 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment