doesitarm/helpers/statuses.js
2021-10-23 14:49:29 -05:00

36 lines
784 B
JavaScript

const statuses = {
'✅': 'native',
'✳️': 'rosetta',
'⏹': 'no-in-progress',
'🚫': 'no',
'🔶': 'unreported',
}
export function getStatusName ( status ) {
for (const key in statuses) {
if (status.trim().startsWith( key )) return statuses[key]
}
throw new Error('Non status matched')
}
export function getStatusOfScan ( appScan, includeVersion = true ) {
const statusName = getStatusName( appScan['Result'] )
if (statusName === 'native') {
return [
'✅ Yes, Native Apple Silicon Support',
includeVersion ? `reported as of v${appScan['App Version']}` : ''
].join('')
}
return '🔶 App has not yet been reported to be native to Apple Silicon'
}
export default statuses