aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJez Ng2012-11-10 01:29:42 -0800
committerJez Ng2012-11-10 01:29:42 -0800
commit386a3cf6c61f225f238f7b67c8b9405986467c33 (patch)
treea4232c0b3eb9bbed8f2a2678037d49c2bb2c360a /lib
parent8b09b8524ff7dedf4cd2e8448522920beb9c68f5 (diff)
parent7497b56d3acba5c8750cca5b000a428d099e66b3 (diff)
downloadvimium-386a3cf6c61f225f238f7b67c8b9405986467c33.tar.bz2
Merge pull request #704 from smblott-github/relevancy
Highlight all matches in a vomnibar suggestion, not just the first.
Diffstat (limited to 'lib')
-rw-r--r--lib/utils.coffee8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/utils.coffee b/lib/utils.coffee
index e89d0aa2..c997b74b 100644
--- a/lib/utils.coffee
+++ b/lib/utils.coffee
@@ -126,6 +126,14 @@ Utils =
return 1
0
+ # Zip two (or more) arrays:
+ # - Utils.zip([ [a,b], [1,2] ]) returns [ [a,1], [b,2] ]
+ # - Length of result is `arrays[0].length`.
+ # - Adapted from: http://stackoverflow.com/questions/4856717/javascript-equivalent-of-pythons-zip-function
+ zip: (arrays) ->
+ arrays[0].map (_,i) ->
+ arrays.map( (array) -> array[i] )
+
# 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::curry = ->