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

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';
var stores = {};
module.exports = function (dialect) {
stores[dialect] = stores[dialect] || {};
const stores = new Map();
module.exports = dialect => {
if (!stores.has(dialect)) {
stores.set(dialect, new Map());
}
return {
clear: function () {
stores[dialect] = {};
clear() {
stores.get(dialect).clear();
},
refresh: function (dataType) {
dataType.types[dialect].forEach(function (type) {
stores[dialect][type] = dataType.parse;
});
refresh(dataType) {
for (const type of dataType.types[dialect]) {
stores.get(dialect).set(type, dataType.parse);
}
},
get: function (type) {
return stores[dialect][type];
get(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!