UNPKG

439 BJavaScriptView Raw
1const exec = require('child_process').execSync
2
3module.exports = () => {
4 let name
5 let email
6
7 try {
8 name = exec('git config --get user.name')
9 email = exec('git config --get user.email')
10 } catch (e) {}
11
12 // JSON.stringify(name.toString().trim()) : "fedor"
13
14 name = name && JSON.stringify(name.toString().trim()).slice(1, -1)
15 email = email && (' <' + email.toString().trim() + '>')
16 return (name || '') + (email || '')
17}