cryptocurrency-icons/scripts/manifest.js

38 lines
899 B
JavaScript
Raw Normal View History

2018-08-13 10:19:25 +00:00
'use strict';
const fs = require('fs');
const path = require('path');
const coins = require('coinlist');
const alphaSort = require('alpha-sort');
2018-08-13 10:19:25 +00:00
const manifest = require('../manifest.json');
const overrides = new Map([
2018-08-31 18:47:19 +00:00
['VRSC', 'VerusCoin'],
['GMR', 'Gimmer'],
2018-09-11 19:04:08 +00:00
['NEXO', 'Nexo'],
2018-09-17 06:53:55 +00:00
['GUSD', 'Gemini dollar'],
2018-10-02 07:09:09 +00:00
['CALL', 'Capital'],
['BOS', 'BOScoin'],
['CIX', 'Cryptonetix'],
['COQUI', 'COQUI Cash'],
['DEEZ', 'DeezNuts'],
2018-10-02 07:28:28 +00:00
['MZC', 'MAZA'],
['CVC', 'Civic'],
2018-10-07 13:37:35 +00:00
['BTM', 'Bitmark'],
['GLXT', 'GLX Token']
]);
const icons = manifest.map(icon => {
const id = typeof icon === 'string' ? icon : icon.symbol;
return {
symbol: id.toUpperCase(),
name: overrides.get(id) || coins.get(id, 'name') || id
};
});
2018-08-13 10:19:25 +00:00
icons.sort((a, b) => alphaSort.asc(a.symbol, b.symbol));
const data = JSON.stringify(icons, null, '\t') + '\n';
2018-08-13 10:19:25 +00:00
fs.writeFileSync(path.resolve(__dirname, '../manifest.json'), data);