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

chilean-plate-validator

v1.0.0

Published

Lightweight, zero-dependency validator for Chilean license plates (PPU)

Readme

chilean-plate-validator

Sabrosura Extrema npm version install size npm downloads License: MIT

🇨🇱 Description

A lightweight, zero-dependency utility to validate and identify Chilean license plates. Updated to comply with the latest 2024-2026 regulations (Ley 21.601).

Features

  • Dual Build: Native support for ESM (import) and CommonJS (require).
  • TypeScript Ready: Full type definitions and typed return values included.
  • Up to date: Supports new formats for trailers, motorcycles, and special vehicles.
  • Strict by default: Validation functions do not normalize internally — input contract is explicit.

⚠️ Breaking changes in v1.0.0

Version 1.0.0 introduces a redesigned API. If you are upgrading from 0.x, the following changes require attention:

Plate type values

All plate type strings have changed format. Update any comparisons in your code:

| v0.x | v1.0.0 | |--------------------------|-------------------------| | 'NEW_VEHICLE_PLATE' | 'new_vehicle_plate' | | 'NEW_MOTORCYCLE_PLATE' | 'new_motorcycle_plate' | | 'OLD_PLATE' | 'old_plate' | | 'POLICE' | 'police' | | 'AMBULANCE' | 'ambulance' | | 'INVALID' | 'invalid' |

Use the exported PlateType object to avoid hardcoding strings:

import { PlateType } from 'chilean-plate-validator';

plateType('BCDF12') === PlateType.NewVehicle // true

Validation is now strict

plateValid and plateType no longer normalize the input internally. Inputs with hyphens or spaces will return false / 'invalid'. Use normalize explicitly if needed:

// v0.x — worked
plateValid('BC-DF12') // true

// v1.0.0 — strict
plateValid('BC-DF12')              // false
plateValid(normalize('BC-DF12'))   // true

Special plate metadata

Special plate categories (diplomatic, police support, etc.) are no longer returned as a type string. Use the new specialPlateInfo function or CLPlate.specialInfo to access their metadata:

// v0.x
plateType('CD1234') // 'CUERPO_DIPLOMÁTICO'

// v1.0.0
plateType('CD1234')        // 'old_plate'
specialPlateInfo('CD1234') // { prefix: 'CD', label: 'Cuerpo diplomático', authority: 'governmental', ... }

🚀 Installation

npm install chilean-plate-validator

🛠 Usage

Using functions

import { normalize, plateValid, plateType, specialPlateInfo } from 'chilean-plate-validator'

// Strict validation — input must be pre-normalized
plateValid('BCDF12') // true
plateValid('BC-DF12') // false

// Normalize first if the input may contain separators
plateValid(normalize('BC-DF12')) // true

// Get plate category
plateType('BCDF12') // 'new_vehicle_plate'
plateType('AA1234') // 'old_plate'
plateType('Z1234')  // 'police'

// Get special plate metadata (old format only)
specialPlateInfo('CD1234') // { prefix: 'CD', label: 'Cuerpo diplomático', authority: 'governmental', ... }
specialPlateInfo('AA1234') // null

Using the PlateType object

Avoid hardcoding type strings — use PlateType for comparisons:

import { plateType, PlateType } from 'chilean-plate-validator'

if (plateType('BCDF12') === PlateType.NewVehicle) {
  // ...
}

Using the CLPlate class

The class normalizes input automatically and exposes memoized results for convenience:

import { CLPlate } from 'chilean-plate-validator'

const plate = new CLPlate('bc-df12')

plate.clean       // 'BCDF12'
plate.isValid     // true
plate.type        // 'new_vehicle_plate'
plate.formatted   // 'BCDF-12'
plate.specialInfo // null

const special = new CLPlate('CD-1234')

special.isValid     // true
special.type        // 'old_plate'
special.formatted   // 'CD-1234'
special.specialInfo // { prefix: 'CD', label: 'Cuerpo diplomático', authority: 'governmental', ... }

📚 Legal basis & documentation

This module follows the official specifications from the Servicio de Registro Civil e Identificación de Chile.

📄 License

This project is licensed under the MIT License.

👤 Author

Gabriel Galilea