Genese complexity report

<- genese.mapper.d.ts
Methods : 14
Complexity index : 8.7
Cyclomatic complexity : 13
Cognitive complexity
100 % Correct 14/14
0 % Warning 0/14 (threshold : 10)
0 % Error 0/14 (threshold : 20)
Cyclomatic complexity
100 % Correct 14/14
0 % Warning 0/14 (threshold : 5)
0 % Error 0/14 (threshold : 10)
Methods of genese.mapper.d.ts
Complexity Index 0.3 Cyclomatic complexity 0
                            
                                
                
                /**
                 * The constructor takes a Class as parameter.
                 * The tConstructor property is an object with the Type corresponding to this Class
                 */
                constructor(tConstructor: TConstructor<T>); // ----------------------------------------------- +0.3 Complexity index (+0.3 atomic)
            
                            
                        
map Complexity Index 0.4 Cyclomatic complexity 1
                            
                                
                
                /**
                 * The core of the generic mapper
                 * If uConstructor is undefined, U equals T and this methodName returns a mapped T object
                 * If not, it returns a mapped U object
                 * uConstructor is useful for extraction of given fields of a T class object
                 */
                map(data: any): T; // ------------------------------------------------------------------------------ +0.4 Complexity index (+0.4 atomic)
            
                            
                        
arrayMap Complexity Index 0.9 Cyclomatic complexity 1
                            
                                
                
                /**
                 * Receives an array of elements to map (with type T) and returns the array of mapped results (with T type)
                 */
                arrayMap(data: any[], tConstructor?: TConstructor<any>): T[]; // ----------------------------------------------------- +0.9 Complexity index (+0.9 atomic)
            
                            
                        
_areStringOrNumber Complexity Index 0.5 Cyclomatic complexity 1
                            
                                
                
                /**
                 * Check if two objects are both string or number.
                 * In this case, returns true.
                 */
                _areStringOrNumber(target: any, source: any): boolean; // -------------- +0.5 Complexity index (+0.5 atomic)
            
                            
                        
_castStringAndNumbers Complexity Index 0.6 Cyclomatic complexity 1
                            
                                
                
                /**
                 * If source and target are both string or number, we cast source into the target's type and returns it.
                 * This methodName adds a tolerance for http requests which returns numbers instead of strings and inversely
                 * Caution : params target and source should not be falsy values
                 */
                _castStringAndNumbers(target: any, source: any): any; // -------------------------------------------------------------- +0.6 Complexity index (+0.6 atomic)
            
                            
                        
_diveMap Complexity Index 0.7 Cyclomatic complexity 1
                            
                                
                
                /**
                 * For a given object with U type (the target model), returns the source object mapped with the U model
                 * If source === null, it returns null
                 * CAUTION: param "target" can't be undefined
                 */
                _diveMap<U>(target: U, source: any): any; // --------------------------------------------------------------------- +0.7 Complexity index (+0.7 atomic)
            
                            
                        
_mapNotPrimitive Complexity Index 0.7 Cyclomatic complexity 1
                            
                                
                
                /**
                 * For non-primitive objects, returns source object mapped with the type of the target (U)
                 * If source === null, it returns null
                 * CAUTION: param "target" can't be undefined
                 */
                _mapNotPrimitive<U>(target: U, source: any): any; // ------------------------------------------------ +0.7 Complexity index (+0.7 atomic)
            
                            
                        
_mapIndexableType Complexity Index 0.6 Cyclomatic complexity 1
                            
                                
                
                /**
                 * When an object haves a field named 'gnIndexableType', that means that this object haves a model like this :
                 * {
                 *   [key: string]: {
                 *       country: string
                 *      }
                 *   } = {
                 *      gnIndexableType: {
                 *           country: ''
                 *      }
                 *  };
                 * For each key of gnIndexableType field, this method returns the corresponding mapped object with the target model
                 * For example, this method will receive an object like this :
                 *
                 * gnIndexableType: {
                 *      country: ''
                 * }
                 *
                 * and will return something like this :
                 *
                 * {
                 *     fr: {
                 *         country: 'France'
                 *     },
                 *     en: {
                 *         country: 'England'
                 *     }
                 * }
                 * Caution: param target should be defined
                 */
                _mapIndexableType(target: any, source: any): any; // ------------------------------------------------------------------------- +0.6 Complexity index (+0.6 atomic)
            
                            
                        
_mapIndexableTypeArray Complexity Index 0.7 Cyclomatic complexity 1
                            
                                
                
                _mapIndexableTypeArray(target: any[], source: any): any; // ------- +0.7 Complexity index (+0.7 atomic)
            
                            
                        
_mapIndexableTypeObject Complexity Index 0.6 Cyclomatic complexity 1
                            
                                
                
                _mapIndexableTypeObject(target: any, source: any): any; // -------- +0.6 Complexity index (+0.6 atomic)
            
                            
                        
_mapArray Complexity Index 0.9 Cyclomatic complexity 1
                            
                                
                
                /**
                 * Map array of objects
                 */
                _mapArray(target: any[], source: any[]): any[]; // --------------- +0.9 Complexity index (+0.9 atomic)
            
                            
                        
_purge Complexity Index 0.4 Cyclomatic complexity 1
                            
                                
                
                /**
                 * Remove specific genese properties
                 */
                _purge(obj: any): any; // -------------------------------- +0.4 Complexity index (+0.4 atomic)
            
                            
                        
_rename Complexity Index 0.8 Cyclomatic complexity 1
                            
                                
                
                /**
                 * If a property of the U class have the decorator @GnRename, this methodName replaces the key of the gnRename http param
                 * This methodName is useful when the backend renamed some DTO properties :
                 * with @GnRename decorator, you can get values from backend without changing the property name of your T objects in every file
                 */
                _rename<U>(uConstructor: TConstructor<U>, data: any): any; // ---------------------------------------------------------------------------- +0.8 Complexity index (+0.8 atomic)
            
                            
                        
translate Complexity Index 0.6 Cyclomatic complexity 1
                            
                                
                
                /**
                 * If data object with type U have keys 'gnTranslate', this methodName returns the same object removing gnTranslate key
                 * and preserving only the gnTranslate[language] objects
                 * Example :
                 * if data is like
                 * {
                 *     gnTranslate: {
                 *         fr: {
                 *             country: 'Allemagne'
                 *         },
                 *         en: {
                 *             country: 'Germany'
                 *         }
                 *     }
                 * }
                 * and if language is 'fr', his methodName will return
                 * {
                 *     country: 'Allemagne'
                 * }
                 */
                translate(data: any, language: string): any; // ---------------------------------------------------------------------------------- +0.6 Complexity index (+0.6 atomic)