fix(zcash-conf): parse comment lines in zcash.conf

This commit is contained in:
George Lima 2019-03-06 09:34:54 -03:00
parent 0e88d924c4
commit c3df064b48
3 changed files with 7 additions and 0 deletions

View File

@ -13,6 +13,7 @@ let originalDate;
const fixedDate = new Date('2018-02-28T09:39:59');
beforeAll(() => {
// $FlowFixMe
dateFns.format = jest.fn(() => '17:01 PM');
originalDate = global.Date;

View File

@ -13,6 +13,7 @@ let originalDate;
const fixedDate = new Date('2018-02-28T09:39:59');
beforeAll(() => {
// $FlowFixMe
dateFns.format = jest.fn(() => '17:01 PM');
originalDate = global.Date;

View File

@ -42,6 +42,11 @@ export const parseZcashConf = (): Promise<Array<string>> => new Promise((resolve
const { rpcuser, rpcpassword, ...payload }: ZcashConfFile = filterObjectNullKeys(
fileString.split('\n').reduce((acc, cur) => {
if (!cur) return acc;
const line = cur.trim();
if (line.startsWith('#')) return acc;
const [key, value] = cur.split('=');
return { ...acc, [key.trim().toLowerCase()]: value.trim() };
}, {}),