-
Notifications
You must be signed in to change notification settings - Fork 171
/
make-stable-protocol.js
30 lines (19 loc) · 805 Bytes
/
make-stable-protocol.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
'use strict';
/**
*
*/
const fs = require('fs');
const tot = JSON.parse(fs.readFileSync(__dirname + '/pages/_data/tot.json', 'utf8'));
const isNotExperimentalOrDeprecated = item => !item.experimental && !item.deprecated;
const stableProtocol = tot;
stableProtocol.domains = stableProtocol.domains.filter(isNotExperimentalOrDeprecated);
stableProtocol.domains.forEach(domain => {
if (domain.types)
domain.types = domain.types.filter(isNotExperimentalOrDeprecated);
if (domain.commands)
domain.commands = domain.commands.filter(isNotExperimentalOrDeprecated);
if (domain.events)
domain.events = domain.events.filter(isNotExperimentalOrDeprecated);
});
// filter out command params, too?
fs.writeFileSync(__dirname + '/pages/_data/1-3.json', JSON.stringify(stableProtocol, null, 2));