Skip to content

Commit 0454161

Browse files
committed
Migrate std docs index to Map
See also rust-lang/rust#118910
1 parent fb662aa commit 0454161

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

extension/index/std-docs.js

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extension/search/docs/base.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,17 @@ class DocSearch {
7272
}
7373

7474
buildIndex(rawSearchIndex) {
75+
if (!rawSearchIndex) {
76+
// if the rawSearchIndex is undefined or null, give it a empty map
77+
// to call iterate.
78+
rawSearchIndex = new Map();
79+
} else if (rawSearchIndex instanceof Object) {
80+
rawSearchIndex = Object.entries(rawSearchIndex);
81+
}
7582
let searchIndex = [];
7683
const searchWords = [];
7784
const charA = "A".charCodeAt(0);
78-
// if the rawSearchIndex is undefined or null, give it a empty object `{}`
79-
// to call iterate.
80-
for (let [crateName, indexItem] of Object.entries(rawSearchIndex || {})) {
85+
for (let [crateName, indexItem] of rawSearchIndex) {
8186
searchWords.push(crateName);
8287
searchIndex.push({
8388
crate: crateName,

0 commit comments

Comments
 (0)