Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

covid19-us-wa

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

covid19-us-wa - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

11

built/src/covid19-us-wa.d.ts

@@ -20,2 +20,11 @@ export interface ICovid19USWACurrent {

}
export interface ICovid19USWAShortHistory {
[date: string]: {
"total": ICovid19USWAStatNode;
"total_tests": {
"positive": number;
"negative": number;
};
};
}
export interface ICovid19USWAStatNode {

@@ -32,2 +41,3 @@ [county: string]: {

HISTORY_URL: string;
SHORT_HISTORY_URL: string;
debug: any;

@@ -39,4 +49,5 @@ constructor();

getHistoryData(): Promise<ICovid19USWAHistory>;
getShortHistoryData(): Promise<ICovid19USWAShortHistory>;
extractHTMLData(html: string): any;
}
//# sourceMappingURL=covid19-us-wa.d.ts.map

@@ -14,2 +14,3 @@ "use strict";

this.HISTORY_URL = "https://nlt-other.s3.amazonaws.com/history.json";
this.SHORT_HISTORY_URL = "https://nlt-other.s3.amazonaws.com/short_history.json";
this.debug = Debug("Covid19USWA");

@@ -79,2 +80,22 @@ }

};
Covid19USWA.prototype.getShortHistoryData = function () {
var _this = this;
return new Promise(function (resolve, reject) {
https_1.default.get(_this.SHORT_HISTORY_URL, function (res) {
var body = "";
_this.debug("status code", res.statusCode);
res.on("data", function (data) {
body += data;
});
res.on("end", function () {
var waData = JSON.parse(body);
_this.debug("Body response", waData);
resolve(waData);
});
}).on('error', function (e) {
console.error(e);
reject(e);
});
});
};
Covid19USWA.prototype.extractHTMLData = function (html) {

@@ -81,0 +102,0 @@ return html;

@@ -28,3 +28,9 @@ "use strict";

});
it('should return short history info for WA', function () {
var covid19USWA = new covid19_us_wa_1.Covid19USWA();
covid19USWA.getShortHistoryData().then(function (data) {
expect(data).to.be.an("object");
});
});
});
//# sourceMappingURL=covid19-us-wa.js.map

38

data/current.json
{
"county": {
"county": {
"Clark": {

@@ -11,6 +11,10 @@ "positive": 1,

},
"Island": {
"GraysHarbor": {
"positive": 1,
"deaths": 0
},
"Island": {
"positive": 3,
"deaths": 0
},
"Jefferson": {

@@ -21,4 +25,4 @@ "positive": 1,

"King": {
"positive": 236,
"deaths": 26
"positive": 270,
"deaths": 27
},

@@ -30,3 +34,3 @@ "Kitsap": {

"Kittitas": {
"positive": 2,
"positive": 3,
"deaths": 0

@@ -39,8 +43,8 @@ },

"Skagit": {
"positive": 1,
"positive": 2,
"deaths": 0
},
"Snohomish": {
"positive": 68,
"deaths": 2
"positive": 108,
"deaths": 3
},

@@ -56,15 +60,15 @@ "Thurston": {

"Unassigned": {
"positive": 36,
"positive": 46,
"deaths": 0
}
},
"total": {
"positive": 366,
"deaths": 29
},
},
"total": {
"positive": 457,
"deaths": 31
},
"total_tests": {
"positive": 366,
"negative": 3037
"positive": 457,
"negative": 4350
},
"last_updated": "03/11/2020 2:25PM PDT"
"last_updated": "03/12/2020 5:00PM PDT"
}

@@ -66,3 +66,71 @@ {

},
"last_updated": "03/11/2020 2:25PM PDT"
"03/12/2020": {
"county": {
"Clark": {
"positive": 1,
"deaths": 0
},
"Grant": {
"positive": 1,
"deaths": 1
},
"GraysHarbor": {
"positive": 1,
"deaths": 0
},
"Island": {
"positive": 3,
"deaths": 0
},
"Jefferson": {
"positive": 1,
"deaths": 0
},
"King": {
"positive": 270,
"deaths": 27
},
"Kitsap": {
"positive": 2,
"deaths": 0
},
"Kittitas": {
"positive": 3,
"deaths": 0
},
"Pierce": {
"positive": 17,
"deaths": 0
},
"Skagit": {
"positive": 2,
"deaths": 0
},
"Snohomish": {
"positive": 108,
"deaths": 3
},
"Thurston": {
"positive": 1,
"deaths": 0
},
"Whatcom": {
"positive": 1,
"deaths": 0
},
"Unassigned": {
"positive": 46,
"deaths": 0
}
},
"total": {
"positive": 457,
"deaths": 31
},
"total_tests": {
"positive": 457,
"negative": 4350
}
},
"last_updated": "03/12/2020 12:25PM PDT"
}
{
"name": "covid19-us-wa",
"version": "1.1.2",
"version": "1.2.0",
"description": "covid19 data scrapper for a state of Washington",

@@ -5,0 +5,0 @@ "main": "built/src/index.js",

@@ -12,2 +12,16 @@ # covid19-us-wa

## Methods
#### getCurrentData()
Returns latest data from the states site
#### getHistoryData()
Returns historic data, including latest update.
#### getShortHistoryData()
Returns abbreviated historic data by removing county key.
## Usage

@@ -71,2 +85,15 @@

});
covid19USWA.getShortHistoryData().then(data => {
console.log("data", data);
/*
Sample output:
{ '03/11/2020':
{
total: { positive: 366, deaths: 29 },
total_tests: { positive: 366, negative: 3037 } },
last_updated: '03/11/2020 2:25PM PDT'
}
*/
});
```

@@ -80,3 +107,4 @@

ICovid19USWACurrent,
ICovid19USWAHistory
ICovid19USWAHistory,
ICovid19USWAShortHistory
} from 'covid19-us';

@@ -89,5 +117,9 @@

covid19USWA.getCurrentData().then((data: ICovid19USWAHistory) => {
covid19USWA.getHistoryData().then((data: ICovid19USWAHistory) => {
console.log(data);
});
covid19USWA.getShortHistoryData().then((data: ICovid19USWAShortHistory) => {
console.log(data);
});
```

@@ -26,2 +26,12 @@ const Debug: any = require('debug');

export interface ICovid19USWAShortHistory {
[date: string]: {
"total": ICovid19USWAStatNode;
"total_tests": {
"positive": number,
"negative": number
};
};
}
export interface ICovid19USWAStatNode {

@@ -40,2 +50,3 @@ [county: string]: {

HISTORY_URL: string = "https://nlt-other.s3.amazonaws.com/history.json";
SHORT_HISTORY_URL: string = "https://nlt-other.s3.amazonaws.com/short_history.json";

@@ -111,2 +122,22 @@ debug: any;

}
getShortHistoryData(): Promise<ICovid19USWAShortHistory> {
return new Promise<ICovid19USWAShortHistory>((resolve, reject) => {
https.get(this.SHORT_HISTORY_URL, (res) => {
let body: string = "";
this.debug("status code", res.statusCode);
res.on("data", (data) => {
body += data;
})
res.on("end", () => {
let waData: ICovid19USWAShortHistory = JSON.parse(body);
this.debug("Body response", waData);
resolve(waData);
});
}).on('error', (e) => {
console.error(e);
reject(e);
});
});
}

@@ -113,0 +144,0 @@ extractHTMLData(html: string): any {

@@ -5,3 +5,4 @@ var expect = require('chai').expect;

ICovid19USWACurrent,
ICovid19USWAHistory
ICovid19USWAHistory,
ICovid19USWAShortHistory
} from '../src/covid19-us-wa';

@@ -36,5 +37,11 @@

});
});
it('should return short history info for WA', function(){
let covid19USWA = new Covid19USWA();
covid19USWA.getShortHistoryData().then((data: ICovid19USWAShortHistory) => {
expect(data).to.be.an("object");
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc