Skip to content

Commit

Permalink
Merge pull request #113 from curbengh/path-array
Browse files Browse the repository at this point in the history
fix: handle zero length 'config.path'
  • Loading branch information
curbengh committed Nov 22, 2019
2 parents dd558c6 + 1ec9760 commit 9f1f7b0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,18 @@ type = type.map((str, i) => {
return str;
});

if (!path || typeof path === 'string' || !Array.isArray(path)) {
if (typeof path === 'string') path = [path];

if (!path || !Array.isArray(path)) {
path = type.map(str => str.concat('.xml'));
}

if (Array.isArray(path) && path.length > 2) {
path = path.slice(0, 2);
if (Array.isArray(path)) {
if (path.length !== type.length) {
if (path.length > type.length) path = path.slice(0, type.length);
else if (path.length === 0) path = type.map(str => str.concat('.xml'));
else path.push(type[1].concat('.xml'));
}
}

path = path.map(str => {
Expand Down

0 comments on commit 9f1f7b0

Please sign in to comment.