[TASK] Avoid unnassary loops in domain name mapping

This commit is contained in:
Xaver Maierhofer 2018-10-21 18:30:48 +02:00
parent 77c94a1f2e
commit 8fdc8dcabb
No known key found for this signature in database
GPG Key ID: 7FDCE23FD2EC9FE8
3 changed files with 6 additions and 3 deletions

View File

@ -9,5 +9,6 @@ rules:
"func-names": 0 "func-names": 0
"guard-for-in": 0 "guard-for-in": 0
"no-undefined": 0 "no-undefined": 0
"consistent-return": 0
"no-nested-ternary": 0 "no-nested-ternary": 0
"no-extend-native": ["error", { "exceptions": ["String"] }] "no-extend-native": ["error", { "exceptions": ["String"] }]

View File

@ -110,9 +110,10 @@ define(['d3-interpolate', 'snabbdom', 'utils/version', 'filters/genericnode', 'h
var domainDict = count(nodes, ['domain'], function (d) { var domainDict = count(nodes, ['domain'], function (d) {
if (config.domainNames) { if (config.domainNames) {
config.domainNames.forEach(function (t) { config.domainNames.some(function (t) {
if (d === t.domain) { if (d === t.domain) {
d = t.name; d = t.name;
return true;
} }
}); });
} }

View File

@ -71,9 +71,10 @@ define(['snabbdom', 'helper', 'moment'], function (V, helper, moment) {
self.showDomain = function showDomain(d) { self.showDomain = function showDomain(d) {
var rt = d.domain; var rt = d.domain;
if (config.domainNames) { if (config.domainNames) {
config.domainNames.forEach(function (t) { config.domainNames.some(function (t) {
if (d.domain === t.domain) { if (rt === t.domain) {
rt = t.name; rt = t.name;
return true;
} }
}); });
} }