lib/git.js
function isValidSha(str) {
  if (typeof str === 'string' && str.length === 40) {
    const res = str.match(/[0-9a-f]/g);
    return res && res.length === 40;
  }
  return false;
}
function isValidSha(str) {
  if (typeof str === 'string' && str.length === 40) {
    const res = str.match(/[0-9a-f]/g);
    return res && res.length === 40;
  }
  return false;
}
function isValidSha ( str ) { if ( typeof str === 'string' && str . length === 40 ) { const res = str . match ( / [0-9a-f] / g ) ; return res && res . length === 40 ; } return false ; }
Checks if the specified string is a valid SHA-1 value.

@param {string} str
@returns {boolean} `true` if `str` represents a valid SHA-1, otherwise `false`
Checks if the specified string is a valid SHA - 1 value .