formatting

This commit is contained in:
Timo Hocker 2020-03-25 16:50:05 +01:00
parent f8416f8b96
commit cb9535a5bc

View File

@ -6,7 +6,6 @@
*/ */
/* eslint-disable no-sync */ /* eslint-disable no-sync */
/* eslint-disable no-console */ /* eslint-disable no-console */
/* eslint-disable no-await-in-loop */ /* eslint-disable no-await-in-loop */
@ -86,10 +85,13 @@ async function fix_all_copy (folder, license = '', software = '') {
const regex = /\/\*\s+\*\sCopyright[\s\S]*?\*\/\n{0,2}/gu; const regex = /\/\*\s+\*\sCopyright[\s\S]*?\*\/\n{0,2}/gu;
await map_all_files (folder, (data, filename) => { await map_all_files (folder, (data, filename) => {
const shebang = /^#!.*?\n\n/gu; const shebang = /^#!.*?\n\n/gu;
const shebang_line = shebang.exec(data); const shebang_line = shebang.exec (data);
if (!/\.js$/.test(filename) && !regex.test (data)) if (!(/\.js$/u).test (filename) && !regex.test (data))
return null; return null;
return (shebang_line ? shebang_line[0] : '') + get_copyright_notice (license, software) + data.replace (regex, '').replace(shebang, ''); return (shebang_line ? shebang_line[0] : '')
+ get_copyright_notice (license, software)
+ data.replace (regex, '')
.replace (shebang, '');
}); });
} }