npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tracking-number-validation

v2.0.2

Published

A simple way to validate tracking number for the following couriers.

Downloads

2,613

Readme

tracking-number-validation

A simple way to validate tracking number for the following couriers.

supported couriers:

  • ups
  • usps
  • dhl
  • fedex
  • ontrac

Updates

v2 api changes. checkout out v1 and v2 branches.

v2 api:

  • getCourier(tracking) -> Array: [courier] //due to the similarity some times there is a match for more then 1 courier
  • getCourierOne: (tracking,courier) -> String: courier //not safe
  • isValid: (tracking) -> Boolean: true/false //return true if match one or more couriers
  • isCourier: (tracking,courier) -> Boolean: true/false
  • getTrackingUrl: (tracking,courier) -> String: url for tracking number.

Usage

v1 api:

Nodejs:

  • npm i tracking-number-validation --save
  • const tnv = require('tracking-number-validation')
  • tnv.getCourier('1Z2869Y60397722027') -> return courier like ups
  • tnv.isValid('1Z2869Y60397722027','fedex') -> return true/false

Javascript:

  • npm i tracking-number-validation --save
  • include main.js in your index.html
<script src="node_modules/tracking-number-validation/dist/main.js"></script>
  • const courier = TNV.getCourier(tr)

Demo

link

Tested Against

UPS:

  • "1Z9999W99999999999": "ups",
  • "1Z12345E1512345676": "ups",
  • "1Z12345E0205271688": "ups",
  • "1Z12345E6605272234": "ups",
  • "1Z12345E0305271640": "ups",
  • "1Z12345E0393657226": "ups",
  • "1Z12345E1305277940": "ups",
  • "1Z12345E6205277936": "ups",
  • "1Z12345E1505270452": "ups",
  • "1Z648616E192760718": "ups",
  • "1ZWX0692YP40636269": "ups",
  • T9999999999: "ups",

FEDEX:

  • "9999 9999 9999": "fedex",
  • "9999 9999 9999 999": "fedex",
  • "999999999999": "fedex",
  • "999999999999999": "fedex",
  • "661377569221": "fedex",
  • "624893691092": "fedex",
  • "61299995669352455464": "fedex",
  • "61299995669151880177": "fedex",

USPS:

  • "9400 1000 0000 0000 0000 00": "usps",
  • "9205 5000 0000 0000 0000 00": "usps",
  • "9407 3000 0000 0000 0000 00": "usps",
  • "9303 3000 0000 0000 0000 00": "usps",
  • "82 000 000 00": "usps",
  • "EC 000 000 000 US": "usps",
  • "9270 1000 0000 0000 0000 00": "usps",
  • "EA 000 000 000 US": "usps",
  • "CP 000 000 000 US": "usps",
  • "9208 8000 0000 0000 0000 00": "usps",
  • "9202 1000 0000 0000 0000 00": "usps",
  • "9400100000000000000000": "usps",
  • "9205500000000000000000": "usps",
  • "9407300000000000000000": "usps",
  • "9303300000000000000000": "usps",
  • "8200000000": "usps",
  • EC000000000US: "usps",
  • "9270100000000000000000": "usps",
  • EA000000000US: "usps",
  • CP000000000US: "usps",
  • "9208800000000000000000": "usps",
  • "9202100000000000000000": "usps",
  • "92748963438592543475924253": "usps",

ONTRAC:

  • C00000000000000: "ontrac",
  • C99999999999999: "ontrac",

DHL:

  • "125-12345678": "dhl",
  • "125 12345678": "dhl",
  • "12512345678": "dhl",
  • SEA1234567: "dhl",
  • LAX1234567: "dhl",