fix: type of parseSHA

This commit is contained in:
EnixCoda 2019-04-09 21:35:12 +08:00
parent e5f0d1b1cb
commit 0892b7dd5e
No known key found for this signature in database
GPG key ID: 0C1A07377913A1DD

View file

@ -21,7 +21,7 @@ function parse(): MetaData & { path: string[] } {
function parseSHA() {
const { type, path } = parse()
return type === 'blob' || type === 'tree' ? path[0] : false
return type === 'blob' || type === 'tree' ? path[0] : undefined
}
function isInRepoPage() {
@ -43,9 +43,9 @@ function isInCodePage(metaData: MetaData = {}) {
const { type, branchName } = mergedRepo
return Boolean(
isInRepoPage() &&
(!type || type === TYPES.TREE || type === TYPES.BLOB) &&
type !== TYPES.COMMIT &&
(branchName || (!type && !branchName))
(!type || type === TYPES.TREE || type === TYPES.BLOB) &&
type !== TYPES.COMMIT &&
(branchName || (!type && !branchName))
)
}