File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,27 +23,27 @@ const isStringWithValue = (value: unknown): value is string => {
2323 return isString ( value ) && value !== "" ;
2424} ;
2525
26- const isBlob = ( value : any ) : value is Blob => {
26+ const isBlob = ( value : unknown ) : value is Blob => {
2727 return (
28- typeof value === "object" &&
29- typeof value . type === "string" &&
30- typeof value . stream === "function" &&
31- typeof value . arrayBuffer === "function" &&
28+ typeof value === "object" && value !== null &&
29+ typeof ( value as Blob ) . type === "string" &&
30+ typeof ( value as Blob ) . stream === "function" &&
31+ typeof ( value as Blob ) . arrayBuffer === "function" &&
3232 typeof value . constructor === "function" &&
3333 typeof value . constructor . name === "string" &&
3434 / ^ ( B l o b | F i l e ) $ / . test ( value . constructor . name ) &&
35- / ^ ( B l o b | F i l e ) $ / . test ( value [ Symbol . toStringTag ] )
35+ / ^ ( B l o b | F i l e ) $ / . test ( ( value as { [ Symbol . toStringTag ] : string } ) [ Symbol . toStringTag ] )
3636 ) ;
3737} ;
3838
39- const isFormData = ( value : any ) : value is FormData => {
39+ const isFormData = ( value : unknown ) : value is FormData => {
4040 return value instanceof FormData ;
4141} ;
4242
4343const base64 = ( str : string ) : string => {
4444 try {
4545 return btoa ( str ) ;
46- } catch ( err ) {
46+ } catch {
4747 return Buffer . from ( str ) . toString ( "base64" ) ;
4848 }
4949} ;
You can’t perform that action at this time.
0 commit comments