aboutsummaryrefslogtreecommitdiffstats
path: root/copy.js
diff options
context:
space:
mode:
authorteramako2008-11-27 15:34:12 +0000
committerteramako2008-11-27 15:34:12 +0000
commit6c66a8e2f7b23e38a4e514d065ca91a50ef32a85 (patch)
tree8a448ddbffb8c1b3b159f2f507208c21c47eab34 /copy.js
parentcc153e5645a9be30b17f24a5a2f28200db6c2b26 (diff)
downloadvimperator-plugins-6c66a8e2f7b23e38a4e514d065ca91a50ef32a85.tar.bz2
optimize completer's code
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@25152 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'copy.js')
-rw-r--r--copy.js6
1 files changed, 1 insertions, 5 deletions
diff --git a/copy.js b/copy.js
index 0934b38..e8b642e 100644
--- a/copy.js
+++ b/copy.js
@@ -94,11 +94,7 @@ commands.addUserCommand(['copy'],'Copy to clipboard',
if (!context.filter){ context.completions = templates; return; }
var candidates = [];
var filter = context.filter.toLowerCase();
- templates.forEach(function(template){
- if (template[0].toLowerCase().indexOf(filter) == 0)
- candidates.push(template);
- });
- context.completions = candidates;
+ context.completions = templates.filter(function(template) template[0].toLowerCase().indexOf(filter) == 0);
},
bang: true
}