Comparing version 3.0.2 to 3.0.3
@@ -53,4 +53,15 @@ "use strict"; | ||
let fullPath = relativePath; | ||
let byPassAbsPathCheck = false; | ||
switch (propertyName) { | ||
case 'at': | ||
byPassAbsPathCheck = true; | ||
break; | ||
case 'entries': | ||
if (!relativePath) { | ||
byPassAbsPathCheck = true; | ||
} | ||
break; | ||
} | ||
// at is a spcfical property exist in FSMerge which takes number as input do not perform path operation on it. | ||
if (propertyName == 'at' || !path.isAbsolute(relativePath)) { | ||
if (byPassAbsPathCheck || !path.isAbsolute(relativePath)) { | ||
// if property is present in the FSMerge do not hijack it with fs operations | ||
@@ -57,0 +68,0 @@ if (this[propertyName]) { |
{ | ||
"name": "fs-merger", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Reads files from a real location", | ||
@@ -15,2 +15,6 @@ "main": "dist/index.js", | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/SparshithNR/fs-merger.git" | ||
}, | ||
"devDependencies": { | ||
@@ -17,0 +21,0 @@ "@types/node": "^12.11.5", |
@@ -71,5 +71,17 @@ "use strict"; | ||
let fullPath = relativePath | ||
let byPassAbsPathCheck = false; | ||
switch (propertyName) { | ||
case 'at': | ||
byPassAbsPathCheck = true; | ||
break; | ||
case 'entries': | ||
if (!relativePath) { | ||
byPassAbsPathCheck = true; | ||
} | ||
break; | ||
} | ||
// at is a spcfical property exist in FSMerge which takes number as input do not perform path operation on it. | ||
if (propertyName == 'at' || !path.isAbsolute(relativePath)) { | ||
if (byPassAbsPathCheck || !path.isAbsolute(relativePath)) { | ||
// if property is present in the FSMerge do not hijack it with fs operations | ||
@@ -76,0 +88,0 @@ if (this[propertyName]) { |
@@ -307,11 +307,33 @@ "use strict"; | ||
it('can read entries from fsMeger.fs as well', function () { | ||
fsMerger = new FSMerge(['fixtures/test-1', 'fixtures/test-2', 'fixtures/test-3']).fs; | ||
let fsEntries = fsMerger.entries('./'); | ||
let fileList = []; | ||
let walkList = ['a.txt', 'b.txt', 'c.txt', 'd.txt', 'test-1/', 'test-1/b.txt', 'test-sub-1/', 'test-sub-1/sub-b.txt', 'test-sub-1/sub-c.txt', 'test-sub-1/test-sub-sub-1/', 'test-sub-1/test-sub-sub-1/sub-sub-b.txt', 'test-sub-1/test-sub-sub-1/sub-sub-c.txt', 'test-sub-2/' ,'x.txt']; | ||
fsEntries.forEach(entry => { | ||
fileList.push(entry.relativePath); | ||
describe('can read entries from fsMeger.fs as well', function () { | ||
it('take path as input', function() { | ||
fsMerger = new FSMerge(['fixtures/test-1', 'fixtures/test-2', 'fixtures/test-3']).fs; | ||
let fsEntries = fsMerger.entries('./'); | ||
let fileList = []; | ||
let walkList = ['a.txt', 'b.txt', 'c.txt', 'd.txt', 'test-1/', 'test-1/b.txt', 'test-sub-1/', 'test-sub-1/sub-b.txt', 'test-sub-1/sub-c.txt', 'test-sub-1/test-sub-sub-1/', 'test-sub-1/test-sub-sub-1/sub-sub-b.txt', 'test-sub-1/test-sub-sub-1/sub-sub-c.txt', 'test-sub-2/' ,'x.txt']; | ||
fsEntries.forEach(entry => { | ||
fileList.push(entry.relativePath); | ||
}); | ||
expect(fileList).to.be.deep.equal(walkList); | ||
}); | ||
expect(fileList).to.be.deep.equal(walkList); | ||
it('takes no input', function() { | ||
fsMerger = new FSMerge(['fixtures/test-1', 'fixtures/test-2', 'fixtures/test-3']).fs; | ||
let fsEntries = fsMerger.entries(); | ||
let fileList = []; | ||
let walkList = ['a.txt', 'b.txt', 'c.txt', 'd.txt', 'test-1/', 'test-1/b.txt', 'test-sub-1/', 'test-sub-1/sub-b.txt', 'test-sub-1/sub-c.txt', 'test-sub-1/test-sub-sub-1/', 'test-sub-1/test-sub-sub-1/sub-sub-b.txt', 'test-sub-1/test-sub-sub-1/sub-sub-c.txt', 'test-sub-2/' ,'x.txt']; | ||
fsEntries.forEach(entry => { | ||
fileList.push(entry.relativePath); | ||
}); | ||
expect(fileList).to.be.deep.equal(walkList); | ||
}); | ||
it('takes empty string as an input', function() { | ||
fsMerger = new FSMerge(['fixtures/test-1', 'fixtures/test-2', 'fixtures/test-3']).fs; | ||
let fsEntries = fsMerger.entries(''); | ||
let fileList = []; | ||
let walkList = ['a.txt', 'b.txt', 'c.txt', 'd.txt', 'test-1/', 'test-1/b.txt', 'test-sub-1/', 'test-sub-1/sub-b.txt', 'test-sub-1/sub-c.txt', 'test-sub-1/test-sub-sub-1/', 'test-sub-1/test-sub-sub-1/sub-sub-b.txt', 'test-sub-1/test-sub-sub-1/sub-sub-c.txt', 'test-sub-2/' ,'x.txt']; | ||
fsEntries.forEach(entry => { | ||
fileList.push(entry.relativePath); | ||
}); | ||
expect(fileList).to.be.deep.equal(walkList); | ||
}); | ||
}); | ||
@@ -318,0 +340,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
51797
952
3
318655