Skip to content

refactor(exported-extractor): Use Map object instead of Object.create #730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/extractors/exported.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function walkExported(
) {
var newResults = [];
var filename = data.file;
var dataCache = Object.create(null);
var dataCache = new Map();

function addBlankComment(data, path, node) {
return addComment(data, '', node.loc, path, node.loc, true);
Expand Down Expand Up @@ -178,7 +178,7 @@ function getCachedData(dataCache, filePath) {
path = require.resolve(path);
}

var value = dataCache[path];
var value = dataCache.get(path);
if (!value) {
var input = fs.readFileSync(path, 'utf-8');
var ast = parseToAst(input, path);
Expand All @@ -189,7 +189,7 @@ function getCachedData(dataCache, filePath) {
},
ast
};
dataCache[path] = value;
dataCache.set(path, value);
}
return value;
}
Expand Down