-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchecks.js
More file actions
25 lines (20 loc) · 817 Bytes
/
checks.js
File metadata and controls
25 lines (20 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const { pluralMap } = require('./lib/typeMaps');
const { fs, path, dataSourcePath } = require('./lib/pathsAndFS');
for (const [type, typePlural] of Object.entries(pluralMap)) {
const sourceFile = path.resolve(dataSourcePath, typePlural +'.json');
if (! fs.existsSync(sourceFile)) continue;
const items = require(sourceFile);
const propsList = require('../data-hubspot/properties/' + typePlural + '.json');
const propMap = {};
for (const p of propsList) { propMap[p.name] = p; }
let missings = {};
for (const item of items) {
for (const field of Object.keys(item)) {
if (field !== '_transitional' && propMap[field] == null) {
if (! missings[field]) missings[field] = 0;
missings[field]++;
}
}
}
console.log('Checked ' + type + ' unkown properties ', missings);
}