diff --git a/.husky/pre-commit b/.husky/pre-commit index abc3a6d..66b9b34 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,6 +1,5 @@ #!/bin/bash -. "$(dirname "$0")/_/husky.sh" . "$(dirname "$0")/common.sh" yarn lint-staged diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg index 8d5740d..3c1f4c9 100755 --- a/.husky/prepare-commit-msg +++ b/.husky/prepare-commit-msg @@ -1,7 +1,6 @@ -#!/bin/bash +#!/bin/sh -. "$(dirname "$0")/_/husky.sh" -. "$(dirname "$0")/common.sh" +# . "$(dirname "$0")/common.sh" # Bash sets the BASH environment variable, so if it is not set, then we # are running in a different shell, so manually run ourselves in BASH. diff --git a/src/utils.js b/src/utils.js index 1d7780d..6df4ec3 100644 --- a/src/utils.js +++ b/src/utils.js @@ -164,7 +164,7 @@ export function setKeyValue(keyValueName, value) { } export function shouldCapitalise(text) { - const multilineRegex = /\s*\n+\s*\w$/; + const multilineRegex = /\s*\n+\s*[a-z]$/; let matches = multilineRegex.test(text); //console.log("matches:" + matches); @@ -173,7 +173,7 @@ export function shouldCapitalise(text) { return true; } - const sentenceRegex = /\w+\s*\W?([.?!])+\s+\w$/; + const sentenceRegex = /\w+\s*\W?([.?!])+\s+[a-z]$/; matches = sentenceRegex.test(text); if (!matches) { diff --git a/test/util.test.js b/test/util.test.js index ad32a6b..f5d6d6d 100644 --- a/test/util.test.js +++ b/test/util.test.js @@ -76,6 +76,8 @@ describe('util file tests', function () { expect(utils.shouldCapitalise(' k ')).toBe(false); expect(utils.shouldCapitalise(' k ')).toBe(false); expect(utils.shouldCapitalise(' ')).toBe(false); + expect(utils.shouldCapitalise(' 1')).toBe(false); + expect(utils.shouldCapitalise('this is ? 1')).toBe(false); expect(utils.shouldCapitalise('?')).toBe(true); expect(utils.shouldCapitalise('!')).toBe(true); @@ -97,6 +99,9 @@ describe('util file tests', function () { expect(utils.shouldCapitalise('war? lasting \n peace \n\n k')).toBe( true ); + + expect(utils.shouldCapitalise('war? \n\n 1')).toBe(false); + expect(utils.shouldCapitalise('war? \n\n 12')).toBe(false); }); test('shouldCapitalise_singleChar', () => {