55const  CodeWriter  =  require ( "./CodeGenUtils" ) 
66var  path  =  require ( 'path' ) ; 
77var  fs  =  require ( 'fs' ) ; 
8- var  _  =  require ( 'lodash' ) ; 
9- 
108
119class  TypeScriptCodeGenerator  { 
1210    /** 
@@ -147,7 +145,7 @@ class TypeScriptCodeGenerator {
147145    writeNamespace ( writeFunction ,  codeWriter ,  elem ,  options )  { 
148146        var  path  =  null ; 
149147        if  ( elem . _parent )  { 
150-             path  =  _ . map ( elem . _parent . getPath ( this . baseModel ) ,   function  ( e )  { 
148+             path  =  elem . _parent . getPath ( this . baseModel ) . map ( function  ( e )  { 
151149                return  e . name ; 
152150            } ) . join ( "." ) ; 
153151        } 
@@ -228,9 +226,7 @@ class TypeScriptCodeGenerator {
228226        // Extends 
229227        var  _extends  =  this . getSuperClasses ( elem ) ; 
230228        if  ( _extends . length  >  0 )  { 
231-             terms . push ( "extends "  +  _ . map ( _extends ,  function  ( e )  { 
232-                 return  e . name ; 
233-             } ) . join ( ", " ) ) ; 
229+             terms . push ( "extends "  +  _extends . map ( function  ( e )  {  return  e . name  } ) . join ( ', ' ) ) 
234230        } 
235231        codeWriter . writeLine ( terms . join ( " " )  +  " {" ) ; 
236232        codeWriter . writeLine ( ) ; 
@@ -306,7 +302,7 @@ class TypeScriptCodeGenerator {
306302
307303        // Modifiers 
308304        var  _modifiers  =  this . getModifiers ( elem ) ; 
309-         if  ( _ . some ( elem . operations ,   function  ( op )  { 
305+         if  ( elem . operations . some ( function  ( op )  { 
310306            return  op . isAbstract  ===  true ; 
311307        } ) )  { 
312308            _modifiers . push ( "abstract" ) ; 
@@ -333,11 +329,11 @@ class TypeScriptCodeGenerator {
333329        var  _implements  =  this . getSuperInterfaces ( elem ) ; 
334330        if  ( _implements . length  >  0 )  { 
335331            if  ( _extends . length  >  0 )  { 
336-                 terms . push ( ", "  +  _ . map ( _implements ,   function  ( e )  { 
332+                 terms . push ( ", "  +  _implements . map ( function  ( e )  { 
337333                    return  e . name ; 
338334                } ) . join ( ", " ) ) ; 
339335            }  else  { 
340-                 terms . push ( "implements "  +  _ . map ( _implements ,   function  ( e )  { 
336+                 terms . push ( "implements "  +  _implements . map ( function  ( e )  { 
341337                    return  e . name ; 
342338                } ) . join ( ", " ) ) ; 
343339            } 
@@ -428,7 +424,7 @@ class TypeScriptCodeGenerator {
428424
429425        // Modifiers 
430426        // var _modifiers = this.getModifiers(elem); 
431-         // if (_.some( elem.operations,  function(op) { 
427+         // if (elem.operations.some( function(op) { 
432428        //         return op.isAbstract === true; 
433429        //     })) { 
434430        //     _modifiers.push("abstract"); 
@@ -451,11 +447,11 @@ class TypeScriptCodeGenerator {
451447        var  _implements  =  this . getSuperInterfaces ( elem ) ; 
452448        if  ( _implements . length  >  0 )  { 
453449            if  ( _extends . length  >  0 )  { 
454-                 terms . push ( ", "  +  _ . map ( _implements ,   function  ( e )  { 
450+                 terms . push ( ", "  +  _implements . map ( function  ( e )  { 
455451                    return  e . name ; 
456452                } ) . join ( ", " ) ) ; 
457453            }  else  { 
458-                 terms . push ( "implements "  +  _ . map ( _implements ,   function  ( e )  { 
454+                 terms . push ( "implements "  +  _implements . map ( function  ( e )  { 
459455                    return  e . name ; 
460456                } ) . join ( ", " ) ) ; 
461457            } 
@@ -541,7 +537,7 @@ class TypeScriptCodeGenerator {
541537
542538            // doc 
543539            var  doc  =  elem . documentation . trim ( ) ; 
544-             _ . each ( params ,   function  ( param )  { 
540+             params . forEach ( function  ( param )  { 
545541                doc  +=  "\n@param "  +  param . name  +  " "  +  param . documentation ; 
546542            } ) ; 
547543            if  ( returnParam )  { 
@@ -581,7 +577,7 @@ class TypeScriptCodeGenerator {
581577            } 
582578
583579            // body 
584-             if  ( skipBody  ===  true  ||  _ . contains ( _modifiers ,   "abstract" ) )  { 
580+             if  ( skipBody  ===  true  ||  _modifiers . includes ( "abstract" ) )  { 
585581                codeWriter . writeLine ( terms . join ( " " )  +  ";" ) ; 
586582            }  else  { 
587583                codeWriter . writeLine ( terms . join ( " " )  +  " {" ) ; 
@@ -640,15 +636,15 @@ class TypeScriptCodeGenerator {
640636        }  else  { 
641637            if  ( elem . type  instanceof  type . UMLModelElement  &&  elem . type . name . length  >  0 )  { 
642638                _type  =  elem . type . name ; 
643-             }  else  if  ( _ . isString ( elem . type )  &&  elem . type . length  >  0 )  { 
639+             }  else  if  ( ( typeof   elem . type   ===   'string' )  &&  elem . type . length  >  0 )  { 
644640                _type  =  elem . type ; 
645641            } 
646642        } 
647643
648644
649645        // multiplicity 
650646        if  ( elem . multiplicity )  { 
651-             if  ( _ . contains ( [ "0..*" ,  "1..*" ,  "*" ] ,   elem . multiplicity . trim ( ) ) )  { 
647+             if  ( [ "0..*" ,  "1..*" ,  "*" ] . includes ( elem . multiplicity . trim ( ) ) )  { 
652648                if  ( elem . isOrdered  ===  true )  { 
653649                    _type  =  "List<"  +  _type  +  ">" ; 
654650                }  else  { 
@@ -731,7 +727,7 @@ class TypeScriptCodeGenerator {
731727     */ 
732728    writeDoc ( codeWriter ,  text ,  options )  { 
733729        var  i ,  len ,  lines ; 
734-         if  ( options . tsDoc  &&  _ . isString ( text ) )  { 
730+         if  ( options . tsDoc  &&  ( typeof   text   ===   'string' ) )  { 
735731            console . log ( "write Doc" ) ; 
736732            lines  =  text . trim ( ) . split ( "\n" ) ; 
737733            codeWriter . writeLine ( "/**" ) ; 
@@ -800,7 +796,7 @@ class TypeScriptCodeGenerator {
800796        var  generalizations  =  app . repository . getRelationshipsOf ( elem ,  function  ( rel )  { 
801797            return  ( rel  instanceof  type . UMLGeneralization  &&  rel . source  ===  elem ) ; 
802798        } ) ; 
803-         return  _ . map ( generalizations ,   function  ( gen )  { 
799+         return  generalizations . map ( function  ( gen )  { 
804800            return  gen . target ; 
805801        } ) ; 
806802    } ; 
@@ -814,7 +810,7 @@ class TypeScriptCodeGenerator {
814810        var  realizations  =  app . repository . getRelationshipsOf ( elem ,  function  ( rel )  { 
815811            return  ( rel  instanceof  type . UMLInterfaceRealization  &&  rel . source  ===  elem ) ; 
816812        } ) ; 
817-         return  _ . map ( realizations ,   function  ( gen )  { 
813+         return  realizations . map ( function  ( gen )  { 
818814            return  gen . target ; 
819815        } ) ; 
820816    } ; 
0 commit comments