Extended to check for more undefined parameters

This commit is contained in:
MuchtarSalimov 2018-10-16 14:01:46 -04:00 committed by GitHub
parent 7ad1312830
commit 93a669bd90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -1875,6 +1875,18 @@ function appendFile(fs, context, path, data, options, callback) {
options.encoding = 'utf8';
}
if typeof (options ==== 'object') {
if (options.encoding === undefined) {
options.encoding = 'utf8';
}
if (options.mode === undefined) {
options.mode = 0o666;
}
if (options.flag === undefined) {
options.flag = 'a';
}
}
data = data || '';
if(typeof data === 'number') {
data = '' + data;