{"action":"closed","issue":{"url":"https://api.github.com/repos/brave/ledger-publisher/issues/3","repository_url":"https://api.github.com/repos/brave/ledger-publisher","labels_url":"https://api.github.com/repos/brave/ledger-publisher/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/brave/ledger-publisher/issues/3/comments","events_url":"https://api.github.com/repos/brave/ledger-publisher/issues/3/events","html_url":"https://github.com/brave/ledger-publisher/issues/3","id":174126273,"number":3,"title":"ledger-publisher Synopsis constructor doesn't initialize properly for JS object input","user":{"login":"willy-b","id":6969859,"avatar_url":"https://avatars.githubusercontent.com/u/6969859?v=3","gravatar_id":"","url":"https://api.github.com/users/willy-b","html_url":"https://github.com/willy-b","followers_url":"https://api.github.com/users/willy-b/followers","following_url":"https://api.github.com/users/willy-b/following{/other_user}","gists_url":"https://api.github.com/users/willy-b/gists{/gist_id}","starred_url":"https://api.github.com/users/willy-b/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willy-b/subscriptions","organizations_url":"https://api.github.com/users/willy-b/orgs","repos_url":"https://api.github.com/users/willy-b/repos","events_url":"https://api.github.com/users/willy-b/events{/privacy}","received_events_url":"https://api.github.com/users/willy-b/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/brave/ledger-publisher/labels/bug","name":"bug","color":"ee0701"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-30T21:07:14Z","updated_at":"2016-09-06T14:05:56Z","closed_at":"2016-09-06T14:05:56Z","body":"`LedgerPublisher.Synopsis` constructor does not treat buf, string, and JSON inputs the same (though the code suggests it will)\r\n\r\nRight now providing a parsed JSON object to the `Synopsis` constructor will not throw an error, \r\nbut will give you a misconfigured `Synopsis` object missing `this.publishers`\r\n\r\nREPL Example:\r\n```\r\n> var ledgerPublisher = require('ledger-publisher')\r\nundefined\r\n> var Synopsis = ledgerPublisher.Synopsis\r\nundefined\r\n> var synopsis = JSON.parse(fs.readFileSync('/home/willy/.config/brave/ledger-synopsis.json').toString())\r\nundefined\r\n> var synopsisObj = new Synopsis(synopsis)\r\nundefined\r\n> synopsisObj.publishers\r\n{}\r\n> synopsisObj.winner()\r\nundefined\r\n```\r\nThe same example repeated with `synopsis` variable left as a Buffer straight from the `ledger-synopsis.json` file works fine.\r\n\r\nNote the data has been loaded, but it is in the wrong place, in this case, the `this.options.publishers` field:\r\n```\r\n> synopsisObj.options.publishers\r\n{ 'reddit.com': \r\n   { visits: 1,\r\n[...]\r\n```"}}
{"actor":{"display_login":"mrose17"}}