Skip to content

Commit b3e4bf7

Browse files
committed
Remove excess code
1 parent 3192d42 commit b3e4bf7

File tree

3 files changed

+2
-26
lines changed

3 files changed

+2
-26
lines changed

lib/config/defaults.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
var config = {
22
defaultFilename: 'index.html',
3-
log: false,
43
sources: [
54
{
65
selector: 'img',
@@ -33,7 +32,7 @@ var config = {
3332
{
3433
selector: 'link[rel*="icon"]',
3534
attr: 'href'
36-
},
35+
}
3736
],
3837
subdirectories: [
3938
{

lib/utils.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
var url = require('url');
22
var path = require('path');
33

4-
function isUrl(path) {
5-
var urlRegexp = /^((http[s]?:)?\/\/)/;
6-
return urlRegexp.test(path);
7-
}
8-
94
function getUrl(currentUrl, path) {
105
var pathObj = url.parse(path);
11-
if (isUrl(path) && !pathObj.protocol) {
6+
if (!pathObj.protocol) {
127
pathObj.protocol = 'http';
138
path = url.format(pathObj);
149
}
@@ -30,7 +25,6 @@ function getFilenameFromUrl (u) {
3025
}
3126

3227
module.exports = {
33-
isUrl: isUrl,
3428
getUrl: getUrl,
3529
getUnixPath: getUnixPath,
3630
getRelativePath: getRelativePath,

test/unit/utils-test.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,6 @@ require('should');
22
var utils = require('../../lib/utils');
33

44
describe('Common utils', function () {
5-
describe('#isUrl(url)', function () {
6-
it('should return true if url starts with "http[s]://"', function () {
7-
utils.isUrl('http://google.com').should.be.true();
8-
utils.isUrl('https://github.com').should.be.true();
9-
});
10-
it('should return true if url starts with "//"', function () {
11-
utils.isUrl('//www.youtube.com').should.be.true();
12-
});
13-
it('should return false if url starts neither with "http[s]://" nor "//"', function () {
14-
utils.isUrl('http//www.youtube.com').should.be.false();
15-
utils.isUrl('http:/www.youtube.com').should.be.false();
16-
utils.isUrl('htt://www.youtube.com').should.be.false();
17-
utils.isUrl('://www.youtube.com').should.be.false();
18-
utils.isUrl('www.youtube.com').should.be.false();
19-
});
20-
});
21-
225
describe('#getUrl(url, path)', function () {
236
it('should return url + path if path is not url', function () {
247
utils.getUrl('http://google.com', '/path').should.be.equal('http://google.com/path');

0 commit comments

Comments
 (0)