File tree Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Expand file tree Collapse file tree 1 file changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ import { StatusDescription } from "./StatusDescription";
44import  {  StatusLabel  }  from  "./StatusLabel" ; 
55import  {  IHttpResponsesDictionary  }  from  "./Interfaces" ; 
66
7+ /** 
8+  * Creates a dictionary containing all HTTP Statuses containing code, phrase and description. 
9+  * 
10+  * @returns  dictionary 
11+  */ 
712export  const  makeHttpResponsesDictionary  =  ( )  =>  { 
813  let  dictionary : IHttpResponsesDictionary  =  { } ; 
914
@@ -30,13 +35,29 @@ export const makeHttpResponsesDictionary = () => {
3035  return  dictionary ; 
3136} ; 
3237
33- export  const  getStatusPhraseByCode  =  ( code : number ) : StatusPhrase  =>  { 
38+ /** 
39+  * Get a status phrase from a given HTTP Status code 
40+  * 
41+  * @param  code {StatusCode|number} 
42+  * @returns  {string } 
43+  */ 
44+ export  const  getStatusPhraseByCode  =  ( 
45+   code : number  |  StatusCode 
46+ ) : StatusPhrase  =>  { 
3447  const  httpDictionary  =  makeHttpResponsesDictionary ( ) ; 
3548
3649  return  httpDictionary [ code ] . phrase ; 
3750} ; 
3851
39- export  const  getStatusDescriptionByCode  =  ( code : number ) : StatusDescription  =>  { 
52+ /** 
53+  * Get a description from a given HTTP Status code 
54+  * 
55+  * @param  code {StatusCode|number} 
56+  * @returns  {string } 
57+  */ 
58+ export  const  getStatusDescriptionByCode  =  ( 
59+   code : number  |  StatusCode 
60+ ) : StatusDescription  =>  { 
4061  const  httpDictionary  =  makeHttpResponsesDictionary ( ) ; 
4162
4263  return  httpDictionary [ code ] . description ; 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments