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 🙏

© 2026 – Pkg Stats / Ryan Hefner

teleguard

v1.1.3

Published

A lightweight, database-agnostic phone number verification utility for modern web applications.

Readme

TeleGuard 🛡️

TeleGuard is an intelligent, high-flexibility phone number validation and formatting utility engine designed specifically for international SMS verification systems. It parses, sanitizes, and matches incoming subscriber numbers against dynamic international routing criteria—preventing database fragmentation and reducing failed SMS API payload expenses.


Key Features

  • Intelligent Overlap Resolution: Safely differentiates between countries sharing identical or nested dialing prefixes (e.g., USA/Canada +1 vs. American Samoa +1684).
  • Flexible Synonyms (Proxy-Driven): Call functions using whichever syntax matches your style (check(), verify(), parse(), clean()).
  • Dual-Execution Paradigm: Fetch responses via traditional method executions validate() OR fluid dot-notation chaining properties tg.phone().isValid.
  • Smart Truncation Handling: Automatically detects and isolates redundant local domestic prefixes (like a leading 0 or 1) even if pre-pended alongside standard country codes.

Core Installation Setup

Install the package via npm:

npm install teleguard

Require and initialize it in your backend module:

const TeleGuard = require('teleguard');
const tg = new TeleGuard({ throwOnError: false });

Implementation Examples

1. Automatic Global Lookup Strategy

Pass a single raw phone number containing arbitrary formatting or whitespace. TeleGuard will automatically resolve the country, strip the formatting, and validate against operator length configurations.

// Method Execution Style
const report = tg.validate("+880 1744-327539");
console.log(report);
/* Output:
{
  isValid: true,
  formattedNumber: "+8801744327539",
  countryName: "Bangladesh",
  alpha2: "BD",
  alpha3: "BGD"
}
*/

// Dynamic Synonym Aliasing Alternative
const reportAlt = tg.verify("+8801744327539");

2. Explicit Country Validation Layer

Validate an incoming local payload string against an explicit target region via its Alpha2, Alpha3, or dialing code identifier. Handles inputs both with or without a local domestic prefix 0 flawlessly.

// 1. Passing with a leading local domestic trunk prefix
const check1 = tg.validateWithCountry("BD", "01744327539");

// 2. Passing without a domestic prefix
const check2 = tg.validateWithCountry("BGD", "1744327539");

// 3. Resilient parsing even if user supplies full international codes to local inputs
const check3 = tg.verifyByCountry("bd", "+8801744327539");

// 4. Smart lookup with partial/incomplete dialing identifiers
const check4 = tg.verifyByCountry("+88", "01744327539");

3. Fluent Chain Dot-Notation Reads

Perfect for clean frontend-backend validation middleware pipelines. Access structured parameters directly as native object properties without running method executions.

// Simple boolean validation flag
const isGenuine = tg.phone("+8801744327539").isValid; // true

// Direct normalized gateway string extraction
const cleanE164 = tg.phone("01744327539").country("BD").formattedNumber; // "+8801744327539"

// Fetch the complete metadata context object
const profile = tg.country("BD", "01744327539").result;

API Reference Method & Synonym Matrix

| Primary Operation Method | Approved Synonym Aliases | Operational Scope Description | | :--- | :--- | :--- | | sanitize(str) | clean, clear, strip, normalize | Strips spacing, symbols, and alphabetical noise leaving numeric characters. | | validate(num) | check, verify, parse | Performs longest-match lookup tracking directly from a lone phone string payload. | validateWithCountry(id, num) | checkWithCountry, verifyWithCountry, parseWithCountry, validateByCountry, verifyByCountry| Evaluates parameters under explicit regional criteria constraints. Supports structured config parameters. |

Global Initialization Options

Configure validation behavior globally upon initializing your Class Instance:

const strictGuard = new TeleGuard({
    throwOnError: true,     // Hard-throws JS Errors instead of returning error objects
    defaultCountry: 'BD'    // Assumes default country code context if single inputs lack prefixes
});

License: MIT © Md Nasiruddin Ahmed KORMOI