diff --git a/snippets/copyright/index.js b/snippets/copyright/index.js index 655b6bd..fecd968 100644 --- a/snippets/copyright/index.js +++ b/snippets/copyright/index.js @@ -6,7 +6,6 @@ */ - /* eslint-disable no-sync */ /* eslint-disable no-console */ /* 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; await map_all_files (folder, (data, filename) => { const shebang = /^#!.*?\n\n/gu; - const shebang_line = shebang.exec(data); - if (!/\.js$/.test(filename) && !regex.test (data)) + const shebang_line = shebang.exec (data); + if (!(/\.js$/u).test (filename) && !regex.test (data)) 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, ''); }); }