node-config-yaml
Version:
Yaml Config for Node.js based on config-yml package
19 lines (14 loc) • 422 B
JavaScript
const _ = require('lodash')
const sh = require('shelljs')
module.exports = function (regex) {
var env = sh.exec('git status', { silent: true }).stdout
env = env.split('\n')[0]
env = env.replace(/^#?\s?On branch ([\w-_/.]+)/, '$1')
env = regex ? env.replace(/\w(\w+)\w/, '$1') : env
env = env ? _.truncate(env, {
length: 13,
omission: ''
}) : undefined
return env
}