File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1+ import { joinAnd } from '@socketsecurity/registry/lib/arrays'
12import { isObject } from '@socketsecurity/registry/lib/objects'
23import { naturalCompare } from '@socketsecurity/registry/lib/sorts'
34import { indentString } from '@socketsecurity/registry/lib/strings'
@@ -39,14 +40,15 @@ export function getFlagApiRequirementsOutput(
3940 let result = ''
4041 if ( data ) {
4142 const quota : number = data ?. quota
42- const perms : string [ ] = data ?. permissions
43+ const rawPerms : string [ ] = data ?. permissions
4344 const padding = '' . padEnd ( indent )
4445 const lines = [ ]
45- if ( typeof quota === 'number' ) {
46+ if ( Number . isFinite ( quota ) && quota > 0 ) {
4647 lines . push ( `${ padding } - Quota: ${ quota } ${ pluralize ( 'unit' , quota ) } ` )
4748 }
48- if ( Array . isArray ( perms ) && perms . length ) {
49- lines . push ( `${ padding } - Permissions: ${ perms . join ( ' ' ) } ` )
49+ if ( Array . isArray ( rawPerms ) && rawPerms . length ) {
50+ const perms = rawPerms . slice ( ) . sort ( naturalCompare )
51+ lines . push ( `${ padding } - Permissions: ${ joinAnd ( perms ) } ` )
5052 }
5153 result += lines . join ( '\n' )
5254 }
You can’t perform that action at this time.
0 commit comments