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

tnkb

v1.0.9

Published

Indonesian's vehicle plate number validator and decoder (Parser nomor tanda kendaraan bermotor/tnkb Indonesia)

Readme

TNKB

English (current) | Bahasa Indonesia

A TypeScript/JavaScript library to validate and parse Indonesian vehicle license plate numbers (TNKB - Tanda Nomor Kendaraan Bermotor).

Features

  • Validate Indonesian vehicle plate numbers
  • Parse and extract plate information (region, province, vehicle type, etc.)
  • Vehicle type detection
  • Support for various plate types:
    • Public vehicles (white plates)
    • Government officials (red plates)
    • Diplomatic & consular vehicles
    • Military & police vehicles
    • Temporary plates
  • Based on official regulations (Peraturan Polri No. 7 Tahun 2021)
  • Accurate vehicle type detection based on registration number ranges
  • Written in TypeScript with full type definitions

Installation

npm install tnkb
yarn add tnkb
pnpm add tnkb

Usage

Basic Validation

import { isValid } from 'tnkb';

console.log(isValid('B 1234 ABC'));  // true
console.log(isValid('B 1234ABC'));   // true (auto-normalized)
console.log(isValid('INVALID'));     // false

Parse Plate Information

import { parse } from 'tnkb';

const result = parse('B 1234 ABC');
console.log(result);
// {
//   isValid: true,
//   type: 'publik',
//   vehicleType: 'Mobil Penumpang',
//   country: 'Indonesia',
//   province: 'DKI Jakarta',
//   region: 'Jakarta, Bekasi, Depok, Tangerang, Tangerang Selatan',
//   prefixCode: 'B',
//   code: '1234',
//   suffixCode: 'ABC'
// }

Different Plate Types

// Public vehicle (motorcycle - Metro Jaya)
parse('B 3456 A');
// { vehicleType: 'Sepeda Motor', ... }

// Government official
parse('RI 1');
// { type: 'pejabat_pemerintah_pusat', vehicleType: 'Presiden', ... }

// Diplomatic vehicle
parse('CD 123 15');
// { type: 'diplomatik', country: 'Amerika Serikat', ... }

// Provincial government
parse('B 123 RI');
// { type: 'pejabat_pemerintah_provinsi', ... }

API Reference

isValid(value: string): boolean

Validates if a string is a valid Indonesian vehicle plate number.

Parameters:

  • value: The plate number string to validate

Returns: true if valid, false otherwise

parse(value: string): ParseResult

Parses and validates an Indonesian vehicle plate number, returning detailed information.

Parameters:

  • value: The plate number string to parse

Returns: ParseResult object with validation status and parsed data

ParseResult Type

type ParseResult = {
  isValid: boolean;
  type?: PlateType;
  vehicleType?: string | null;
  country?: string;
  province?: string | null;
  region?: string | null;
  prefixCode?: string;
  code?: string;
  suffixCode?: string | null;
  error?: string;
}

type PlateType = 
  | "publik"
  | "diplomatik"
  | "konsulat"
  | "konsul_kehormatan"
  | "pejabat_pemerintah_pusat"
  | "pejabat_pemerintah_provinsi"
  | "pejabat_pemerintah_kabupaten_kota"
  | "sementara";

Regulations

(Last updated: 29 Jan 2026)

This package validates and decodes plate numbers based on:

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

Hisam Fahri: @hisamafahri

License

MIT