diff --git a/src/gitinfo.js b/src/gitinfo.js index 7409a94..9aee418 100644 --- a/src/gitinfo.js +++ b/src/gitinfo.js @@ -2,9 +2,9 @@ import fs from 'fs'; import path from 'path'; +import R from 'ramda'; import { parseRemoteOriginUrl, - trim, parseIni, isGitDirectory, findGitPath @@ -129,7 +129,7 @@ export default (userConfig: TypeConfig = {}): Object => { throw new Error('Cannot read the commit SHA of the current HEAD from the ' + shaFile + '.\n' + err); } - return trim(sha); + return R.trim(sha); }; /** diff --git a/src/utils.js b/src/utils.js index 03a605d..2228e91 100644 --- a/src/utils.js +++ b/src/utils.js @@ -114,11 +114,3 @@ export const findGitPath = (startPath: string): string => { return gitpath; }; - -/** - * @param value A string to be trimmed. - * @returns An initial string without leading and trailing spaces, tabs, newlines - */ -export const trim = (value: string): string => { - return value.replace(/^\s+|\s+$/g, ''); -}; diff --git a/tests/utils.js b/tests/utils.js index 430d93f..0f4f1cc 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -6,8 +6,7 @@ import { } from 'chai'; import { findGitPath, - parseRemoteOriginUrl, - trim + parseRemoteOriginUrl } from './../src/utils'; describe('utils', () => { @@ -46,9 +45,4 @@ describe('utils', () => { }); }); }); - describe('trim()', () => { - it('trims whitespaces, tabs and newlines', () => { - expect(trim(' \tsomeText with spaces\n')).to.equal('someText with spaces'); - }); - }); });