2017-08-17 20:36:55 +00:00
|
|
|
const fs = require('fs');
|
2017-08-17 20:55:47 +00:00
|
|
|
const UAList = require('../src/useragents').useragents;
|
2017-08-17 20:36:55 +00:00
|
|
|
const json2yaml = require('json2yaml');
|
2017-08-17 20:55:47 +00:00
|
|
|
const Parser = require('../lib/parser').default;
|
2017-08-17 20:36:55 +00:00
|
|
|
|
|
|
|
const newBrowserList = {};
|
|
|
|
|
|
|
|
for (const browserName in UAList) {
|
|
|
|
const newBrowser = [];
|
|
|
|
const browserClass = UAList[browserName];
|
|
|
|
|
|
|
|
for (const browserUA in browserClass) {
|
|
|
|
const parsedUA = new Parser(browserUA).parse().getResult();
|
|
|
|
const newBrowserDeclaration = {
|
|
|
|
ua: browserUA
|
|
|
|
};
|
|
|
|
// const browserDeclaration = browserClass[browserUA];
|
|
|
|
|
|
|
|
newBrowserDeclaration.spec = parsedUA;
|
|
|
|
|
|
|
|
newBrowser.push(newBrowserDeclaration);
|
|
|
|
}
|
|
|
|
|
|
|
|
newBrowserList[browserName] = newBrowser;
|
|
|
|
}
|
|
|
|
|
|
|
|
const yaml = json2yaml.stringify(newBrowserList);
|
|
|
|
|
|
|
|
fs.writeFileSync('useragentstrings.yml', yaml);
|