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

ptv

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ptv - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

33

index.js

@@ -18,3 +18,3 @@ var urlFormat = require('url').format;

function createSignature(url, args) {
function createSignature(key, url, args) {
return crypto.createHmac('sha1', key)

@@ -28,2 +28,3 @@ .update(urlFormat({pathname: '/v2' + url, query: args}))

this.key = opts.key;
this._activeReqs = 0;
}

@@ -36,4 +37,6 @@

query.for_utc = utc.toISOString();
var signature = createSignature(url, query);
var signature = createSignature(this.key, url, query);
query.signature = signature;
this._activeReqs++;
var ptv = this;
request({

@@ -43,9 +46,10 @@ url: endpoint + '/v2' + url,

}, function(error, response, body) {
ptv._activeReqs--;
if (!error && response.statusCode == 200) {
try {
result = JSON.parse(body);
cb(null, result);
} catch(e) {
cb(e);
return cb(e);
}
cb(null, result);
} else {

@@ -67,3 +71,6 @@ if (error)

util.format('/nearme/latitude/%d/longitude/%d', latitude, longitude),
cb
function(err, res) {
if (err) return cb(err);
return cb(null, res.map(function(s) { return s.result; }));
}
);

@@ -96,2 +103,4 @@ };

PTV.modeName = ['train', 'tram', 'bus', 'vline', 'nightrider'];
PTV.prototype.broadNextDepartures = function(mode, stop, limit, date, cb) {

@@ -106,2 +115,4 @@ if (!date)

if (err) return cb(err);
//if (!res || !res.values)
// console.log(res);
cb(null, res.values);

@@ -120,3 +131,8 @@ }

date,
cb
function(err, res) {
if (err) return cb(err);
//if (!res || !res.values)
// console.log(res);
cb(null, res.values);
}
);

@@ -132,3 +148,6 @@ };

date,
cb
function(err, res) {
if (err) return cb(err);
cb(null, res.values);
}
);

@@ -135,0 +154,0 @@ };

{
"name": "ptv",
"version": "0.1.1",
"version": "0.1.2",
"description": "Public Transport Victoria API client",

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

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