From 4ca93a6a88dc0f8c600e163f295abe5757abe263 Mon Sep 17 00:00:00 2001 From: Jacob Tran Date: Wed, 20 Jun 2018 14:13:57 -0700 Subject: [PATCH] lodash instead --- index.js | 4 +--- test/_env.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 34aa4ab..fb36e7a 100644 --- a/index.js +++ b/index.js @@ -60,9 +60,7 @@ function getEnvIdFromBranch () { try { let branch = sh.exec('git name-rev HEAD --name-only').stdout - branch = branch.split('/') - - branch = branch[branch.length - 1] + branch = _.last(_.split(branch, '/')) return _.trimEnd(_.truncate(branch, { length: 13, diff --git a/test/_env.js b/test/_env.js index e1636ed..95ea5ab 100644 --- a/test/_env.js +++ b/test/_env.js @@ -6,9 +6,7 @@ const sh = require('shelljs') module.exports = function (regex) { var env = sh.exec('git name-rev HEAD --name-only').stdout - env = env.split('/') - - env = env[env.length - 1] + env = _.last(_.split(env, '/')) return env ? _.truncate(env, { length: 13,