Skip to content

Commit 4fba412

Browse files
author
deiu
committed
Sigh. Better naming for pathBasename()
1 parent e313943 commit 4fba412

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

lib/header.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ function linksHandler(req, res, next) {
4949
}
5050

5151
// Add ACL and Meta Link in header
52-
addLink(res, utils.basePathName(req.path) + ldp.suffixAcl, 'acl');
53-
addLink(res, utils.basePathName(req.path) + ldp.suffixMeta, 'describedBy');
52+
addLink(res, utils.pathBasename(req.path) + ldp.suffixAcl, 'acl');
53+
addLink(res, utils.pathBasename(req.path) + ldp.suffixMeta, 'describedBy');
5454
// Add other Link headers
5555
addLinks(res, fileMetadata);
5656
next();

lib/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function uriBase(req) {
4242
return uriAbs(req) + (req.baseUrl || '');
4343
}
4444

45-
function basePathName(fullpath) {
45+
function pathBasename(fullpath) {
4646
var bname = '';
4747
if (fullpath) {
4848
bname = (fullpath.lastIndexOf('/') === fullpath.length - 1)?'':path.basename(fullpath);
@@ -84,7 +84,7 @@ exports.uriToFilename = uriToFilename;
8484
exports.uriToRelativeFilename = uriToRelativeFilename;
8585
exports.filenameToBaseUri = filenameToBaseUri;
8686
exports.uriAbs = uriAbs;
87-
exports.basePathName = basePathName;
87+
exports.pathBasename = pathBasename;
8888
exports.uriBase = uriBase;
8989
exports.getResourceLink = getResourceLink;
9090
exports.formatDateTime = formatDateTime;

test/utils.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ var utils = require('../lib/utils');
44

55
describe('Utility functions', function() {
66

7-
describe('basename', function() {
7+
describe('pathBasename', function() {
88
it('should return bar as relative path for /foo/bar', function() {
9-
assert.equal(utils.basePathName('/foo/bar'), 'bar');
9+
assert.equal(utils.pathBasename('/foo/bar'), 'bar');
1010
});
1111
it('should return empty as relative path for /foo/', function() {
12-
assert.equal(utils.basePathName('/foo/'), '');
12+
assert.equal(utils.pathBasename('/foo/'), '');
1313
});
1414
it('should return empty as relative path for /', function() {
15-
assert.equal(utils.basePathName('/'), '');
15+
assert.equal(utils.pathBasename('/'), '');
1616
});
1717
it('should return empty as relative path for empty path', function() {
18-
assert.equal(utils.basePathName(''), '');
18+
assert.equal(utils.pathBasename(''), '');
1919
});
2020
it('should return empty as relative path for undefined path', function() {
21-
assert.equal(utils.basePathName(undefined), '');
21+
assert.equal(utils.pathBasename(undefined), '');
2222
});
2323
});
2424
});

0 commit comments

Comments
 (0)