Socket
Socket
Sign inDemoInstall

shipit

Package Overview
Dependencies
241
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.3 to 1.1.4

54

lib/amazon.js

@@ -15,3 +15,3 @@ (function() {

AmazonClient = (function() {
var STATUS_MAP;
var DAYS_OF_WEEK, MONTHS, STATUS_MAP;

@@ -49,7 +49,43 @@ class AmazonClient extends ShipperClient {

getEta(data) {
var $, response;
var $, arrival, day_num, day_of_week, eta, foundMonth, i, len, matchResult, month, response;
if (data == null) {
return;
}
return ({$, response} = data);
eta = null;
({$, response} = data);
matchResult = response.toString().match('"promiseMessage":"Arriving (.*?)"');
if (matchResult == null) {
matchResult = response.toString().match('"promiseMessage":"Now expected (.*?)"');
}
arrival = matchResult != null ? matchResult[1] : void 0;
if (arrival.match('today')) {
eta = moment();
} else if (arrival.match('tomorrow')) {
eta = moment().add(1, 'day');
} else {
if (arrival.match('-')) {
arrival = arrival.split('-')[1];
}
foundMonth = false;
for (i = 0, len = MONTHS.length; i < len; i++) {
month = MONTHS[i];
if (upperCase(arrival).match(month)) {
foundMonth = true;
}
}
if (foundMonth) {
eta = moment(arrival).year(moment().year());
} else {
for (day_of_week in DAYS_OF_WEEK) {
day_num = DAYS_OF_WEEK[day_of_week];
if (upperCase(arrival).match(day_of_week)) {
eta = moment().day(day_num);
}
}
}
}
if (!(eta != null ? eta.isValid() : void 0)) {
return;
}
return eta != null ? eta.hour(20).minute(0).second(0).milliseconds(0) : void 0;
}

@@ -123,2 +159,14 @@

MONTHS = ['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER'];
DAYS_OF_WEEK = {
'SUNDAY': 0,
'MONDAY': 1,
'TUESDAY': 2,
'WEDNESDAY': 3,
'THURSDAY': 4,
'FRIDAY': 5,
'SATURDAY': 6
};
return AmazonClient;

@@ -125,0 +173,0 @@

2

package.json
{
"name": "shipit",
"version": "1.1.3",
"version": "1.1.4",
"description": "This module allows you to connect to many shipping carriers like UPS and FedEx and download tracking data for your packages in a common schema",

@@ -5,0 +5,0 @@ "main": "lib/main.js",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc