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

use RegExp#test in preference to String#match

This commit is contained in:
Doug Kearns
2007-11-16 12:48:03 +00:00
parent fea5cceecc
commit f50bca0453
9 changed files with 44 additions and 45 deletions

View File

@@ -1009,20 +1009,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)