Skip to content

Commit

Permalink
fix: compatible with Node.js 14 (#60)
Browse files Browse the repository at this point in the history
* ci(travis): add node 14
  • Loading branch information
SukkaW committed Apr 25, 2020
1 parent afd256a commit e137971
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -11,6 +11,7 @@ node_js:
- "10"
- "12"
- "13"
- "14"

script:
- npm run eslint
Expand Down
5 changes: 4 additions & 1 deletion lib/fs.js
Expand Up @@ -55,6 +55,8 @@ function checkParent(path) {
function writeFile(path, data, options, callback) {
if (!path) throw new TypeError('path is required!');

if (!data) data = '';

if (!callback && typeof options === 'function') {
callback = options;
options = {};
Expand Down Expand Up @@ -93,6 +95,7 @@ function copyFile(src, dest, flags, callback) {
if (!dest) throw new TypeError('dest is required!');
if (typeof flags === 'function') {
callback = flags;
flags = undefined;
}

return checkParent(dest).then(() => fsPromises.copyFile(src, dest, flags)).asCallback(callback);
Expand Down Expand Up @@ -156,7 +159,7 @@ async function _copyDir(src, dest, options, parent) {
return _copyDir(childSrc, childDest, options, currentPath);
}

return copyFile(childSrc, childDest, options).thenReturn(currentPath);
return copyFile(childSrc, childDest).thenReturn(currentPath);
}), reduceFiles, []);
}

Expand Down

0 comments on commit e137971

Please sign in to comment.