From 6c66a8e2f7b23e38a4e514d065ca91a50ef32a85 Mon Sep 17 00:00:00 2001 From: teramako Date: Thu, 27 Nov 2008 15:34:12 +0000 Subject: optimize completer's code git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@25152 d0d07461-0603-4401-acd4-de1884942a52 --- copy.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'copy.js') 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 } -- cgit v1.2.3