autocomplete-trie/build/demo/data.js

42 lines
1.2 KiB
JavaScript
Raw Normal View History

2015-07-26 08:53:28 +00:00
"use strict";
2015-07-26 07:27:50 +00:00
2015-07-26 08:53:28 +00:00
var data = new Trie();
2015-07-26 07:27:50 +00:00
2015-07-26 08:53:28 +00:00
var json = {
"color": ["red", "rebecca", "blue", "cyan", "pink", "purple", "teal", "black", "white", "orange", "yellow", "green"],
"name": ["Jack", "James", "Alex", "Adam", "Mahdi", "Josh", "Scott", "Pat", "Vincent", "Daniel", "Patrick", "Tim"],
"app": ["Atom", "Sublime", "Firefox", "Chrome", "Safari", "Mail", "Blender", "Sketch", "Slack", "Finder", "Nightly", "Aurora", "f.lux", "LookUp", "WunderList", "Instagram", "Toggl"]
};
2015-07-26 07:27:50 +00:00
2015-07-26 08:53:28 +00:00
for (var category in json) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
2015-07-26 07:27:50 +00:00
2015-07-26 08:53:28 +00:00
try {
for (var _iterator = json[category][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var item = _step.value;
var node = data.add(item);
node.category = category;
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator["return"]) {
_iterator["return"]();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
document.addEventListener('DOMContentLoaded', function () {
draw(true);
});