File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -33,8 +33,8 @@ interface AbortableFetch {
3333/**
3434 * Passing this function as a Promise handler will make the promise fail when the predicate is not true.
3535 */
36- export const rejectUnless =
37- ( pred : ( response : Response ) => boolean ) => ( response : Response ) => {
36+ export function rejectUnless ( pred : ( response : Response ) => boolean ) : ( ( Response ) => Response ) {
37+ return ( response : Response ) => {
3838 if ( pred ( response ) ) {
3939 return response ;
4040 } else {
@@ -43,12 +43,13 @@ export const rejectUnless =
4343 throw err ;
4444 }
4545 } ;
46+ }
4647
4748/**
4849 * fetch API considers a HTTP error a successful state.
4950 * Passing this function as a Promise handler will make the promise fail when HTTP error occurs.
5051 */
51- export const rejectIfNotOkay = ( response : Response ) => {
52+ export function rejectIfNotOkay ( response : Response ) : Response {
5253 return rejectUnless ( ( response : Response ) => response . ok ) ( response ) ;
5354} ;
5455
You can’t perform that action at this time.
0 commit comments