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

@fye/carrier-tracking-links

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fye/carrier-tracking-links - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

36

index.js

@@ -50,9 +50,37 @@ /*

function getTrackingLink(rawTrackingNumber) {
function formatCarrier(carrier) {
const parts = carrier
.replace(/-/gi, ' ')
.trim()
.split(' ');
if (parts.length) {
let name = (parts[0] || '').trim();
if (name.toUpperCase() === 'FEDEXSP') {
// treat smart post as fedex
name = 'FedEx';
}
return name;
}
return carrier;
}
function getTrackingLink(rawTrackingNumber, carrier) {
// remove spaces from the tracking number
const trackingNumber = (rawTrackingNumber || '').replace(/\s/gi, '');
const matched = CARRIER_REGEX_CACHE.find(cache => {
return cache.reg.test(trackingNumber);
});
let matched;
if (carrier) {
const formattedCarrier = formatCarrier(carrier).toLowerCase();
matched = CARRIERS.find(cache => {
return cache.name.toLowerCase() === formattedCarrier;
});
} else {
matched = CARRIER_REGEX_CACHE.find(cache => {
return cache.reg.test(trackingNumber);
});
}
if (!matched) {

@@ -59,0 +87,0 @@ return null;

4

package.json
{
"name": "@fye/carrier-tracking-links",
"version": "1.0.0",
"version": "1.1.0",
"description": "Return Carrier Name and Link for a Tracking Number",

@@ -14,3 +14,3 @@ "main": "index.js",

},
"gitHead": "a1456d3f533fd7b64d4ab3270c62a0fae66e95eb"
"gitHead": "ed3426ab9e2882a19cc3b4694131fa308e80ce52"
}
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