diff --git a/examples/index.js b/examples/index.js
index f6d2c2efde..1c0d754434 100644
--- a/examples/index.js
+++ b/examples/index.js
@@ -43,15 +43,15 @@
}
};
words.forEach(function (word) {
- const dict = info.index[word];
+ const dict = info.wordIndex[word];
if (dict) {
updateScores(dict, word);
} else {
const r = new RegExp(word);
// eslint-disable-next-line prefer-const
- for (let idx in info.index) {
+ for (let idx in info.wordIndex) {
if (r.test(idx)) {
- updateScores(info.index[idx], word);
+ updateScores(info.wordIndex[idx], word);
}
}
}
diff --git a/examples/templates/example.html b/examples/templates/example.html
index 29c3e7463d..4acd5e0e47 100644
--- a/examples/templates/example.html
+++ b/examples/templates/example.html
@@ -113,7 +113,7 @@
{{#each tags}}
- {{.}}
+ {{ ./tag }} ({{ ./amount }})
{{/each}}
{{{ contents }}}
diff --git a/examples/webpack/example-builder.js b/examples/webpack/example-builder.js
index 39a94acec7..301cce23c5 100644
--- a/examples/webpack/example-builder.js
+++ b/examples/webpack/example-builder.js
@@ -30,6 +30,43 @@ handlebars.registerHelper('indent', (text, options) => {
.join('\n');
});
+/**
+ * Returns the object with the keys inserted in alphabetic order.
+ * When exporting with `JSON.stringify(obj)` the keys are sorted.
+ * @param {Object} obj Any object
+ * @return {Object} New object
+ */
+function sortObjectByKey(obj) {
+ return Object.keys(obj)
+ .sort() // sort twice to get predictable, case insensitve order
+ .sort((a, b) => a.localeCompare(b, 'en', {sensitivity: 'base'}))
+ .reduce((idx, tag) => {
+ idx[tag] = obj[tag];
+ return idx;
+ }, {});
+}
+
+/**
+ * Create an index of tags belonging to examples
+ * @param {Array