1
1
/**
2
- * Copyright 2022 Angus.Fenying <[email protected] >
2
+ * Copyright 2023 Angus.Fenying <[email protected] >
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -1890,11 +1890,9 @@ export const COMMANDS: Record<keyof C.ICommandAPIs, ICommand> = {
1890
1890
} ,
1891
1891
process ( data : any , args : any [ ] ) : string | null | string [ ] {
1892
1892
1893
- switch ( data ?. length ?? 0 ) {
1894
- case 0 :
1895
- return args [ 1 ] ? [ ] : null ;
1893
+ switch ( args . length ) {
1896
1894
case 1 :
1897
- return args [ 1 ] ? [ data [ 0 ] [ 1 ] . toString ( ) ] : data . toString ( ) ;
1895
+ return data ? .toString ( ) ?? null ;
1898
1896
default :
1899
1897
return U . list2StringList ( data ) ;
1900
1898
}
@@ -1915,11 +1913,9 @@ export const COMMANDS: Record<keyof C.ICommandAPIs, ICommand> = {
1915
1913
} ,
1916
1914
process ( data : any , args : any [ ] ) : Buffer | null | Buffer [ ] {
1917
1915
1918
- switch ( data ?. length ?? 0 ) {
1919
- case 0 :
1920
- return args [ 1 ] ? [ ] : null ;
1916
+ switch ( args . length ) {
1921
1917
case 1 :
1922
- return args [ 1 ] ? [ data [ 0 ] [ 1 ] ] : data ;
1918
+ return data ?? null ;
1923
1919
default :
1924
1920
return U . list2BufferList ( data ) ;
1925
1921
}
@@ -2012,11 +2008,9 @@ export const COMMANDS: Record<keyof C.ICommandAPIs, ICommand> = {
2012
2008
} ,
2013
2009
process ( data : any , args : any [ ] ) : string | null | string [ ] {
2014
2010
2015
- switch ( data ?. length ?? 0 ) {
2016
- case 0 :
2017
- return args [ 1 ] ? [ ] : null ;
2011
+ switch ( args . length ) {
2018
2012
case 1 :
2019
- return args [ 1 ] ? [ data [ 0 ] [ 1 ] . toString ( ) ] : data . toString ( ) ;
2013
+ return data ? .toString ( ) ?? null ;
2020
2014
default :
2021
2015
return U . list2StringList ( data ) ;
2022
2016
}
@@ -2037,11 +2031,9 @@ export const COMMANDS: Record<keyof C.ICommandAPIs, ICommand> = {
2037
2031
} ,
2038
2032
process ( data : any , args : any [ ] ) : Buffer | null | Buffer [ ] {
2039
2033
2040
- switch ( data ?. length ?? 0 ) {
2041
- case 0 :
2042
- return args [ 1 ] ? [ ] : null ;
2034
+ switch ( args . length ) {
2043
2035
case 1 :
2044
- return args [ 1 ] ? [ data [ 0 ] [ 1 ] ] : data ;
2036
+ return data ?? null ;
2045
2037
default :
2046
2038
return U . list2BufferList ( data ) ;
2047
2039
}
0 commit comments