11/**
2- * Copyright 2022 Angus.Fenying <fenying@litert.org>
2+ * Copyright 2023 Angus.Fenying <fenying@litert.org>
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -1890,11 +1890,9 @@ export const COMMANDS: Record<keyof C.ICommandAPIs, ICommand> = {
18901890 } ,
18911891 process ( data : any , args : any [ ] ) : string | null | string [ ] {
18921892
1893- switch ( data ?. length ?? 0 ) {
1894- case 0 :
1895- return args [ 1 ] ? [ ] : null ;
1893+ switch ( args . length ) {
18961894 case 1 :
1897- return args [ 1 ] ? [ data [ 0 ] [ 1 ] . toString ( ) ] : data . toString ( ) ;
1895+ return data ? .toString ( ) ?? null ;
18981896 default :
18991897 return U . list2StringList ( data ) ;
19001898 }
@@ -1915,11 +1913,9 @@ export const COMMANDS: Record<keyof C.ICommandAPIs, ICommand> = {
19151913 } ,
19161914 process ( data : any , args : any [ ] ) : Buffer | null | Buffer [ ] {
19171915
1918- switch ( data ?. length ?? 0 ) {
1919- case 0 :
1920- return args [ 1 ] ? [ ] : null ;
1916+ switch ( args . length ) {
19211917 case 1 :
1922- return args [ 1 ] ? [ data [ 0 ] [ 1 ] ] : data ;
1918+ return data ?? null ;
19231919 default :
19241920 return U . list2BufferList ( data ) ;
19251921 }
@@ -2012,11 +2008,9 @@ export const COMMANDS: Record<keyof C.ICommandAPIs, ICommand> = {
20122008 } ,
20132009 process ( data : any , args : any [ ] ) : string | null | string [ ] {
20142010
2015- switch ( data ?. length ?? 0 ) {
2016- case 0 :
2017- return args [ 1 ] ? [ ] : null ;
2011+ switch ( args . length ) {
20182012 case 1 :
2019- return args [ 1 ] ? [ data [ 0 ] [ 1 ] . toString ( ) ] : data . toString ( ) ;
2013+ return data ? .toString ( ) ?? null ;
20202014 default :
20212015 return U . list2StringList ( data ) ;
20222016 }
@@ -2037,11 +2031,9 @@ export const COMMANDS: Record<keyof C.ICommandAPIs, ICommand> = {
20372031 } ,
20382032 process ( data : any , args : any [ ] ) : Buffer | null | Buffer [ ] {
20392033
2040- switch ( data ?. length ?? 0 ) {
2041- case 0 :
2042- return args [ 1 ] ? [ ] : null ;
2034+ switch ( args . length ) {
20432035 case 1 :
2044- return args [ 1 ] ? [ data [ 0 ] [ 1 ] ] : data ;
2036+ return data ?? null ;
20452037 default :
20462038 return U . list2BufferList ( data ) ;
20472039 }
0 commit comments