fix: it should be value and not name

This commit is contained in:
Mahdi Dibaiee
2016-11-02 18:31:19 +03:30
parent 63a70a4e94
commit 97ec628663
8 changed files with 18 additions and 18 deletions

View File

@ -56,7 +56,7 @@ function keyup() {
var category = node.category ? "- " + node.category : '';
results.innerHTML += "<li>" + node.name + " " + category + "</li>";
results.innerHTML += "<li>" + node.value + " " + category + "</li>";
}
} catch (err) {
_didIteratorError2 = true;

View File

@ -47,7 +47,7 @@ input.addEventListener('keydown', function (e) {
if (!current.children.length) return;
input.value = current.children[0].name;
input.value = current.children[0].value;
}
});
@ -68,7 +68,7 @@ function keyup() {
var category = node.category ? "- " + node.category : '';
results.innerHTML += "<li>" + node.name + " " + category + "</li>";
results.innerHTML += "<li>" + node.value + " " + category + "</li>";
}
} catch (err) {
_didIteratorError2 = true;

View File

@ -35,7 +35,7 @@ function draw(small) {
nodeElements.attr('transform', function (d) {
return 'translate(' + d.x + ', ' + d.y + ')';
}).style('font-family', 'monospace').style('font-size', (small ? '6' : '11') + 'px').attr('data-word', function (d) {
return d.name;
return d.value;
});
nodesEnter.append('circle');
@ -47,6 +47,6 @@ function draw(small) {
var texts = svg.selectAll('g.node text').data(nodes);
texts.attr('dy', 5).html(function (d) {
return '<tspan>' + d.name.split('').join('</tspan><tspan>') + '</tspan>';
return '<tspan>' + d.value.split('').join('</tspan><tspan>') + '</tspan>';
}).attr('text-anchor', 'middle').style('fill', 'white');
}

View File

@ -9,7 +9,7 @@ var Node = function Node(value, parent) {
_classCallCheck(this, Node);
this.name = value;
this.value = value;
this.children = [];
this.parent = parent;
};
@ -29,11 +29,11 @@ var Trie = (function () {
var _loop = function (i, len) {
if (!parent.children) parent.children = [];
var node = parent.children.find(function (child) {
return child.name[i] === value[i];
return child.value[i] === value[i];
});
if (!node) {
node = new Node(value.slice(0, i + 1), parent.name);
node = new Node(value.slice(0, i + 1), parent.value);
parent.children.push(node);
}
@ -53,7 +53,7 @@ var Trie = (function () {
var _loop2 = function (i, len) {
parent = parent.children.find(function (child) {
return child.name[i] === value[i];
return child.value[i] === value[i];
});
if (!parent) return {