diff options
| author | Phil Crosby | 2012-05-05 16:28:28 -0700 | 
|---|---|---|
| committer | Phil Crosby | 2012-05-05 18:32:14 -0700 | 
| commit | b7d445c74b188077898779103c4fa951fab17b66 (patch) | |
| tree | 95faa823e206926d958a45746629226c4dda17e8 /lib | |
| parent | 00cdb82cdd025a8d246073330d9970563d1676cb (diff) | |
| download | vimium-b7d445c74b188077898779103c4fa951fab17b66.tar.bz2 | |
Make createActionOpenUrl be a simple function.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/utils.js | 11 | 
1 files changed, 11 insertions, 0 deletions
| diff --git a/lib/utils.js b/lib/utils.js index a5887e89..ab44e43f 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -166,6 +166,17 @@ Function.prototype.proxy = function(self) {  };  /* + * This creates a new function out of an existing function, where the new function takes fewer arguments. + * This allows us to pass around functions instead of functions + a partial list of arguments. + */ +Function.prototype.curry = function(fixedArguments) { +  var fn = this; +  return function() { return fn.apply(this, fixedArguments.concat(Array.copy(arguments))); }; +}; + +Array.copy = function(array) { return Array.prototype.slice.call(array, 0); }; + +/*   * Simple JavaScript Inheritance, by John Resig.   * This provides a short syntax for organizing code into classes.   * Taken from http://ejohn.org/blog/simple-javascript-inheritance/. | 
