forked from nsjcy/frontEnd/nsjcy

Mr Ke
2020-05-27 942cb64adf9f3f8113549ffc9f64e6861d556064
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const strftime = require('hife/strftime').default;
module.exports = args => [
  `/**\n`,
  ` * ${strip(process.env.AUTHORINFO)}\n`,
  ` * ${strftime(Date.now())}\n`,
  `${args.length > 0 ? ' *\n' : ''}`,
  `${args.map(arg => ` * ${arg}\n`)}`,
  ` *\n`,
  ` */\n\n`
].join('');
 
 
function strip(info) {
  if (info) {
    const short = /^[" `']*([^" `']+ ?<[-_.@:a-z0-9]+>)[" `']*$/i.exec(info);
    if (short) return short[1];
    return '姓名<example@email.com>'
  }
  return '请设置 AUTHORINFO 环境变量'
}