[Pkg-javascript-commits] [node-coveralls] 106/332: Ah, right, ES5 has String#trim(), keep forgetting that…

Bastien Roucariès rouca at moszumanska.debian.org
Thu Nov 9 13:53:46 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-coveralls.

commit b12c8cf5f0bc11486e2b064a834ee9ff81adb0a3
Author: Christophe Porteneuve <tdd at tddsworld.com>
Date:   Fri Nov 8 20:02:29 2013 +0100

    Ah, right, ES5 has String#trim(), keep forgetting that…
---
 lib/detectLocalGit.js | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/detectLocalGit.js b/lib/detectLocalGit.js
index 2d0fba0..4fd8d1b 100644
--- a/lib/detectLocalGit.js
+++ b/lib/detectLocalGit.js
@@ -16,15 +16,11 @@ module.exports = function detectLocalGit(knownCommit, knownBranch) {
   if ('/' === dir)
     return;
 
-  var head = strip(fs.readFileSync(path.join(dir, '.git', 'HEAD'), 'utf-8'));
+  var head = fs.readFileSync(path.join(dir, '.git', 'HEAD'), 'utf-8').trim();
   var branch = (head.match(REGEX_BRANCH) || [])[1];
   if (!branch)
     return { git_commit: head };
 
-  var commit = strip(fs.readFileSync(path.join(dir, '.git', 'refs', 'heads', branch), 'utf-8'));
+  var commit = fs.readFileSync(path.join(dir, '.git', 'refs', 'heads', branch), 'utf-8').trim();
   return { git_commit: commit, git_branch: branch };
 };
-
-function strip(str) {
-  return (str || '').replace(/^\s+|\s+$/g, '');
-}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-coveralls.git



More information about the Pkg-javascript-commits mailing list