blob: f6edb6fd3d5ad887372136ae565313241a19bff6 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001var mdnProperties = require('mdn-data/css/properties.json');
2var mdnSyntaxes = require('mdn-data/css/syntaxes.json');
3var patch = require('./patch.json');
4
5function buildDictionary(dict, patchDict) {
6 var result = {};
7
8 // copy all syntaxes for an original dict
9 for (var key in dict) {
10 result[key] = dict[key].syntax;
11 }
12
13 // apply a patch
14 for (var key in patchDict) {
15 if (key in dict) {
16 if (patchDict[key].syntax) {
17 result[key] = patchDict[key].syntax;
18 } else {
19 delete result[key];
20 }
21 } else {
22 if (patchDict[key].syntax) {
23 result[key] = patchDict[key].syntax;
24 }
25 }
26 }
27
28 return result;
29}
30
31module.exports = {
32 properties: buildDictionary(mdnProperties, patch.properties),
33 types: buildDictionary(mdnSyntaxes, patch.syntaxes)
34};