Skip to content

Commit

Permalink
0.1.7
Browse files Browse the repository at this point in the history
- isJSON -> safeJsonParse
- Added Circle CI-config
  • Loading branch information
itssimple committed Dec 17, 2018
1 parent 9634d33 commit d114d28
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
29 changes: 29 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:10.14.2

working_directory: ~/repo

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- deps-{{ checksum "yarn.lock" }}

- run: yarn --frozen-lockfile
- run: yarn build
- run: yarn dist

- save_cache:
paths:
- node_modules
key: deps-{{ checksum "yarn.lock" }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rattracker",
"version": "0.1.6-alpha",
"version": "0.1.7-alpha",
"author": {
"name": "CMDR NoLifeKing",
"email": "[email protected]"
Expand Down
18 changes: 7 additions & 11 deletions src/Lib/Journal/EDJournalLogParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,21 @@ module.exports = {
CanSynthesizeLifesupport: false,
Status: null
},
isJson(line) {
safeJsonParse(line) {
try {
JSON.parse(line);
return JSON.parse(line);
} catch (e) {
return false;
return null;
}

return true;
},
parseStatusFile(line) {
if (this.isJson(line)) {
const status = JSON.parse(line);
const status = this.safeJsonParse(line);
if (!!status)
this.localData.Status = status;
}
},
parseLogLine(line) {
if (this.isJson(line)) {
const logItem = JSON.parse(line);
const logItem = this.safeJsonParse(line);
if (!!logItem) {
switch (logItem.event) {
case 'Continued':
// TODO: Handle continued logs
Expand All @@ -83,7 +80,6 @@ module.exports = {
case 'BuyExplorationData':
case 'BuyTradeData':
case 'CapShipBond':

case 'CargoDepot':
case 'ChangeCrewRole':
case 'CollectCargo':
Expand Down

0 comments on commit d114d28

Please sign in to comment.