Skip to content

Commit

Permalink
Update: Use remove-trailing-separator standalone module (closes #114) (
Browse files Browse the repository at this point in the history
  • Loading branch information
darsain authored and phated committed Sep 27, 2016
1 parent 7e59a83 commit 3411e59
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 63 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var path = require('path');
var clone = require('clone');
var cloneStats = require('clone-stats');
var cloneBuffer = require('./lib/cloneBuffer');
var stripTrailingSep = require('./lib/stripTrailingSep');
var removeTrailingSep = require('remove-trailing-separator');
var isBuffer = require('./lib/isBuffer');
var isStream = require('./lib/isStream');
var isNull = require('./lib/isNull');
Expand Down Expand Up @@ -192,7 +192,7 @@ Object.defineProperty(File.prototype, 'cwd', {
if (!cwd || typeof cwd !== 'string') {
throw new Error('cwd must be a non-empty string.');
}
this._cwd = stripTrailingSep(normalize(cwd));
this._cwd = removeTrailingSep(normalize(cwd));
},
});

Expand All @@ -208,7 +208,7 @@ Object.defineProperty(File.prototype, 'base', {
if (typeof base !== 'string' || !base) {
throw new Error('base must be a non-empty string, or null/undefined.');
}
base = stripTrailingSep(normalize(base));
base = removeTrailingSep(normalize(base));
if (base !== this._cwd) {
this._base = base;
}
Expand Down Expand Up @@ -297,7 +297,7 @@ Object.defineProperty(File.prototype, 'path', {
if (typeof path !== 'string') {
throw new Error('path should be a string.');
}
path = stripTrailingSep(normalize(path));
path = removeTrailingSep(normalize(path));

// Record history only when path changed
if (path && path !== this.path) {
Expand All @@ -316,7 +316,7 @@ Object.defineProperty(File.prototype, 'symlink', {
throw new Error('symlink should be a string');
}

this._symlink = stripTrailingSep(normalize(symlink));
this._symlink = removeTrailingSep(normalize(symlink));
},
});

Expand Down
11 changes: 0 additions & 11 deletions lib/stripTrailingSep.js

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"clone-stats": "^1.0.0",
"cloneable-readable": "^0.5.0",
"readable-stream": "^2.1.0",
"remove-trailing-separator": "^1.0.1",
"replace-ext": "^1.0.0"
},
"devDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions test/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ var from = miss.from;
var concat = miss.concat;
var isCloneable = cloneable.isCloneable;

var isWin = (process.platform === 'win32');

describe('File', function() {

describe('isVinyl()', function() {
Expand Down Expand Up @@ -880,7 +882,7 @@ describe('File', function() {
expect(file.cwd).toEqual(expected);

var val2 = '\\test\\foo\\..\\foo\\';
var expected2 = path.normalize(val2.slice(0, -1));
var expected2 = path.normalize(isWin ? val2.slice(0, -1) : val2);

file.cwd = val2;

Expand Down Expand Up @@ -980,7 +982,7 @@ describe('File', function() {
expect(file.base).toEqual(expected);

var val2 = '\\test\\foo\\..\\foo\\';
var expected2 = path.normalize(val2.slice(0, -1));
var expected2 = path.normalize(isWin ? val2.slice(0, -1) : val2);

file.base = val2;

Expand Down
45 changes: 0 additions & 45 deletions test/strip-trailing-sep.js

This file was deleted.

0 comments on commit 3411e59

Please sign in to comment.