不要怂,就是干,撸起袖子干!

Commit 7dc351f5 by Felix Becker Committed by Mick Hansen

ES6 refactor of parserStore.js (#6083)

const, method shorthands, for of, arrow functions, ES6 Map
1 parent 9717f90c
Showing with 15 additions and 11 deletions
'use strict'; 'use strict';
var stores = {}; const stores = new Map();
module.exports = function (dialect) {
stores[dialect] = stores[dialect] || {}; module.exports = dialect => {
if (!stores.has(dialect)) {
stores.set(dialect, new Map());
}
return { return {
clear: function () { clear() {
stores[dialect] = {}; stores.get(dialect).clear();
}, },
refresh: function (dataType) { refresh(dataType) {
dataType.types[dialect].forEach(function (type) { for (const type of dataType.types[dialect]) {
stores[dialect][type] = dataType.parse; stores.get(dialect).set(type, dataType.parse);
}); }
}, },
get: function (type) { get(type) {
return stores[dialect][type]; return stores.get(dialect).get(type);
} }
}; };
}; };
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!