@@ -300,7 +300,9 @@ class BoxCommand extends Command {
300300 // Set up the command for bulk run
301301 DEBUG . init ( 'Preparing for bulk input' ) ;
302302 this . isBulk = true ;
303+ // eslint-disable-next-line unicorn/prefer-structured-clone
303304 originalArgs = _ . cloneDeep ( this . constructor . args ) ;
305+ // eslint-disable-next-line unicorn/prefer-structured-clone
304306 originalFlags = _ . cloneDeep ( this . constructor . flags ) ;
305307 this . disableRequiredArgsAndFlags ( ) ;
306308 }
@@ -615,7 +617,7 @@ class BoxCommand extends Command {
615617 let parsedData ;
616618 try {
617619 let jsonFile = JSON . parse ( fileContents ) ;
618- parsedData = jsonFile . hasOwnProperty ( 'entries' )
620+ parsedData = Object . hasOwn ( jsonFile , 'entries' )
619621 ? jsonFile . entries
620622 : jsonFile ;
621623 } catch ( error ) {
@@ -651,10 +653,7 @@ class BoxCommand extends Command {
651653 // Arrays can be one of two things: an array of values for a single key,
652654 // or an array of grouped flags/args as objects
653655 // First, check if everything in the array is either all object or all non-object
654- let types = value . reduce (
655- ( acc , t ) => acc . concat ( typeof t ) ,
656- [ ]
657- ) ;
656+ let types = value . map ( ( t ) => typeof t ) ;
658657 if (
659658 types . some ( ( t ) => t !== 'object' ) &&
660659 types . includes ( 'object' )
@@ -1196,11 +1195,10 @@ class BoxCommand extends Command {
11961195 if ( Array . isArray ( content ) ) {
11971196 // Format each object individually and then flatten in case this an array of arrays,
11981197 // which happens when a command that outputs a collection gets run in bulk
1199- formattedOutputData = (
1200- await Promise . all (
1201- content . map ( ( o ) => this . _formatOutputObject ( o ) )
1202- )
1203- ) . flat ( ) ;
1198+ const formattedOutputResults = await Promise . all (
1199+ content . map ( ( o ) => this . _formatOutputObject ( o ) )
1200+ ) ;
1201+ formattedOutputData = formattedOutputResults . flat ( ) ;
12041202 DEBUG . output (
12051203 'Formatted %d output entries for display' ,
12061204 content . length
@@ -1649,9 +1647,10 @@ class BoxCommand extends Command {
16491647 if ( ! fields ) {
16501648 return output ;
16511649 }
1652- fields = REQUIRED_FIELDS . concat (
1653- fields . split ( ',' ) . filter ( ( f ) => ! REQUIRED_FIELDS . includes ( f ) )
1654- ) ;
1650+ fields = [
1651+ ...REQUIRED_FIELDS ,
1652+ ...fields . split ( ',' ) . filter ( ( f ) => ! REQUIRED_FIELDS . includes ( f ) ) ,
1653+ ] ;
16551654 DEBUG . output ( 'Filtering output with fields: %O' , fields ) ;
16561655 if ( Array . isArray ( output ) ) {
16571656 output = output . map ( ( o ) =>
@@ -1723,7 +1722,7 @@ class BoxCommand extends Command {
17231722 ) {
17241723 let subKeys = this . getNestedKeys ( object [ key ] ) ;
17251724 subKeys = subKeys . map ( ( x ) => `${ key } .${ x } ` ) ;
1726- keys = keys . concat ( subKeys ) ;
1725+ keys = [ ... keys , ... subKeys ] ;
17271726 } else {
17281727 keys . push ( key ) ;
17291728 }
@@ -1757,10 +1756,10 @@ class BoxCommand extends Command {
17571756 ) ;
17581757
17591758 // Successively apply the offsets to the current time
1760- newDate = argPairs . reduce (
1761- ( d , args ) => offsetDate ( d , ... args ) ,
1762- new Date ( )
1763- ) ;
1759+ newDate = new Date ( ) ;
1760+ for ( const args of argPairs ) {
1761+ newDate = offsetDate ( newDate , ... args ) ;
1762+ }
17641763 } else if ( time === 'now' ) {
17651764 newDate = new Date ( ) ;
17661765 } else {
0 commit comments