1- import { stringJoinWithSeparateFinalSeparator } from './misc'
21import { pick } from './objects'
2+ import { stringJoinWithSeparateFinalSeparator } from './strings'
33
44import type { SocketSdkReturnType } from '@socketsecurity/sdk'
55
@@ -22,28 +22,24 @@ function getDesiredSeverities(
2222 lowestToInclude : SocketIssue [ 'severity' ] | undefined
2323) : SocketIssue [ 'severity' ] [ ] {
2424 const result : SocketIssue [ 'severity' ] [ ] = [ ]
25-
2625 for ( const severity of SEVERITIES_BY_ORDER ) {
2726 result . push ( severity )
2827 if ( severity === lowestToInclude ) {
2928 break
3029 }
3130 }
32-
3331 return result
3432}
3533
3634export function formatSeverityCount (
3735 severityCount : Record < SocketIssue [ 'severity' ] , number >
3836) : string {
3937 const summary : string [ ] = [ ]
40-
4138 for ( const severity of SEVERITIES_BY_ORDER ) {
4239 if ( severityCount [ severity ] ) {
4340 summary . push ( `${ severityCount [ severity ] } ${ severity } ` )
4441 }
4542 }
46-
4743 return stringJoinWithSeparateFinalSeparator ( summary )
4844}
4945
@@ -57,16 +53,13 @@ export function getSeverityCount(
5753 ) as Record < SocketIssue [ 'severity' ] , number >
5854
5955 for ( const issue of issues ) {
60- const value = issue . value
61-
56+ const { value } = issue
6257 if ( ! value ) {
6358 continue
6459 }
65-
6660 if ( severityCount [ value . severity ] !== undefined ) {
6761 severityCount [ value . severity ] += 1
6862 }
6963 }
70-
7164 return severityCount
7265}
0 commit comments