Skip to content

Commit 421b11f

Browse files
committed
Remove lodash
1 parent a327f73 commit 421b11f

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

code-generator.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
*
2222
*/
2323

24-
const _ = require('lodash')
2524
const fs = require('fs')
2625
const path = require('path')
2726
const codegen = require('./codegen-utils')
@@ -71,7 +70,7 @@ class PythonCodeGenerator {
7170
var inherits = app.repository.getRelationshipsOf(elem, function (rel) {
7271
return (rel.source === elem && (rel instanceof type.UMLGeneralization || rel instanceof type.UMLInterfaceRealization))
7372
})
74-
return _.map(inherits, function (gen) { return gen.target })
73+
return inherits.map(function (gen) { return gen.target })
7574
}
7675

7776
/**
@@ -110,7 +109,7 @@ class PythonCodeGenerator {
110109
} else {
111110
line = 'self.' + elem.name
112111
}
113-
if (elem.multiplicity && _.includes(['0..*', '1..*', '*'], elem.multiplicity.trim())) {
112+
if (elem.multiplicity && ['0..*', '1..*', '*'].includes(elem.multiplicity.trim())) {
114113
line += ' = []'
115114
} else if (elem.defaultValue && elem.defaultValue.length > 0) {
116115
line += ' = ' + elem.defaultValue
@@ -182,7 +181,7 @@ class PythonCodeGenerator {
182181

183182
// params
184183
var params = elem.getNonReturnParameters()
185-
var paramStr = _.map(params, function (p) { return p.name }).join(', ')
184+
var paramStr = params.map(function (p) { return p.name }).join(', ')
186185

187186
if (elem.isStatic) {
188187
codeWriter.writeLine('@classmethod')
@@ -243,7 +242,7 @@ class PythonCodeGenerator {
243242
// Import
244243
if (_inherits.length > 0) {
245244
_inherits.forEach(function (e) {
246-
var _path = _.map(e.getPath(self.baseModel), function (item) { return item.name }).join('.')
245+
var _path = e.getPath(self.baseModel).map(function (item) { return item.name }).join('.')
247246
codeWriter.writeLine('from ' + _path + ' import ' + e.name)
248247
})
249248
codeWriter.writeLine()
@@ -254,7 +253,7 @@ class PythonCodeGenerator {
254253

255254
// Inherits
256255
if (_inherits.length > 0) {
257-
line += '(' + _.map(_inherits, function (e) { return e.name }).join(', ') + ')'
256+
line += '(' + _inherits.map(function (e) { return e.name }).join(', ') + ')'
258257
}
259258

260259
codeWriter.writeLine(line + ':')

0 commit comments

Comments
 (0)