1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 23:18:01 +01:00

use RegExp#test in preference to String#match

This commit is contained in:
Doug Kearns
2007-11-22 11:46:49 +00:00
parent d5c5869d56
commit 708fafe4a6
7 changed files with 39 additions and 41 deletions

View File

@@ -893,20 +893,18 @@ vimperator.Mappings = function () //{{{
));
function isDirectory(url)
{
if (url.match(/^file:\/\//) || url.match(/^\//))
if (/^file:\/\/|^\//.test(url))
{
var stripedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2");
var file = vimperator.io.getFile(stripedFilename);
var strippedFilename = url.replace(/^(file:\/\/)?(.*)/, "$2");
var file = vimperator.io.getFile(strippedFilename);
if (!file || !file.isDirectory())
return false;
else
return true;
}
// for all other locations just check if the URL ends with /
if (url.match(/\/$/))
return true;
else
return false;
return /\/$/.test(url);
}
addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ["gu", "<BS>"],
function (count)