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

@mediocre/bloodhound

Package Overview
Dependencies
Maintainers
2
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mediocre/bloodhound - npm Package Compare versions

Comparing version 1.3.3 to 1.4.0

17

carriers/pitneyBowes.js

@@ -19,3 +19,13 @@ const async = require('async');

this.track = function(trackingNumber, callback) {
this.track = function(trackingNumber, options, callback) {
// Options are optional
if (typeof options === 'function') {
callback = options;
options = {};
}
if (!options.minDate) {
options.minDate = new Date(0);
}
// Pitney Bowes Marketing Mail Flats (length 31): 0004290252994200071698133931119

@@ -105,2 +115,7 @@ const isImb = trackingNumber.length === 31;

// Ensure event is after minDate (used to prevent data from reused tracking numbers)
if (event.date < options.minDate) {
return;
}
if (DELIVERED_TRACKING_STATUS_CODES.includes(scanDetail.scanType.toString())) {

@@ -107,0 +122,0 @@ results.deliveredAt = new Date(event.date);

43

index.js

@@ -59,3 +59,3 @@ const NodeGeocoder = require('node-geocoder');

this.track = function(trackingNumber, carrier, callback) {
this.track = function(trackingNumber, options, callback) {
if (!trackingNumber) {

@@ -65,14 +65,21 @@ return callback(new Error('Tracking number is not specified.'));

// Carrier is optional
if (typeof carrier === 'function') {
callback = carrier;
carrier = undefined;
// Options are optional
if (typeof options === 'function') {
options = {};
callback = options;
}
// Backwards compatibility
if (typeof options === 'string') {
options = {
carrier: options
};
}
// Try to guess the carrier
if (!carrier) {
carrier = this.guessCarrier(trackingNumber);
if (!options.carrier) {
options.carrier = this.guessCarrier(trackingNumber);
// If we still don't know the carrier return an error
if (!carrier) {
if (!options.carrier) {
return callback(new Error('Unknown carrier.'));

@@ -82,20 +89,20 @@ }

carrier = carrier.toLowerCase();
options.carrier = options.carrier.toLowerCase();
trackingNumber = trackingNumber.replace(/\s/g, '');
trackingNumber = trackingNumber.toUpperCase();
if (carrier === 'dhl') {
if (options.carrier === 'dhl') {
dhl.track(trackingNumber, callback);
} else if (carrier === 'fedex') {
} else if (options.carrier === 'fedex') {
fedEx.track(trackingNumber, callback);
} else if (carrier === 'newgistics') {
pitneyBowes.track(trackingNumber, callback);
} else if (carrier === 'pitney bowes') {
pitneyBowes.track(trackingNumber, callback);
} else if (carrier === 'ups'){
} else if (options.carrier === 'newgistics') {
pitneyBowes.track(trackingNumber, options, callback);
} else if (options.carrier === 'pitney bowes') {
pitneyBowes.track(trackingNumber, options, callback);
} else if (options.carrier === 'ups'){
ups.track(trackingNumber, callback);
} else if (carrier === 'usps') {
} else if (options.carrier === 'usps') {
usps.track(trackingNumber, callback);
} else {
return callback(new Error(`Carrier ${carrier} is not supported.`));
return callback(new Error(`Carrier ${options.carrier} is not supported.`));
}

@@ -102,0 +109,0 @@ };

@@ -7,4 +7,4 @@ {

"node-geocoder": "~3.27.0",
"petty-cache": "~2.6.1",
"pitney-bowes": "~0.1.2",
"petty-cache": "~3.0.1",
"pitney-bowes": "~0.2.0",
"shipping-fedex": "0.2.0",

@@ -42,3 +42,3 @@ "tz-lookup": "~6.1.25",

},
"version": "1.3.3"
"version": "1.4.0"
}
# Bloodhound
[![Build Status](https://github.com/mediocre/bloodhound/workflows/build/badge.svg](https://github.com/mediocre/bloodhound/actions?query=workflow%3Abuild)
[![Build Status](https://github.com/mediocre/bloodhound/workflows/build/badge.svg)](https://github.com/mediocre/bloodhound/actions?query=workflow%3Abuild)
[![Coverage Status](https://coveralls.io/repos/github/mediocre/bloodhound/badge.svg)](https://coveralls.io/github/mediocre/bloodhound)

@@ -14,3 +14,3 @@

**Common format**
**Common format**

@@ -53,3 +53,3 @@ Bloodhound interfaces with several carrier APIs and returns results in a single, unified format.

bloodhound.track('tracking number', 'USPS', function(err, data) {
bloodhound.track('tracking number', { carrier: 'USPS' }, function(err, data) {
console.log(data);

@@ -136,3 +136,3 @@ });

### bloodhound.track(trackingNumber, [carrier,] callback)
### bloodhound.track(trackingNumber, [options,] callback)

@@ -142,3 +142,3 @@ Retrieves tracking data for the specified tracking number.

```javascript
bloodhound.track('tracking number', 'USPS', function(err, data) {
bloodhound.track('tracking number', { carrier: 'USPS' }, function(err, data) {
console.log(data);

@@ -154,4 +154,4 @@ });

"address": {
"city": "CARROLLTON",
"state": "TX",
"city": "CARROLLTON",
"state": "TX",
"zip": "75010"

@@ -164,4 +164,4 @@ },

"address": {
"city": "CARROLLTON",
"state": "TX",
"city": "CARROLLTON",
"state": "TX",
"zip": "75010"

@@ -176,2 +176,2 @@ },

}
```
```

@@ -128,2 +128,2 @@ const async = require('async');

exports.geocoder = NodeGeocoder({ provider: 'openstreetmap' });
exports.geocoder = NodeGeocoder({ apiKey: process.env.GOOGLE_API_KEY, language: 'en', provider: 'google', region: '.us' });
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