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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@frankfmy/validation

v1.1.1

Published

ArkType схемы валидации: Email, PhoneRU, INN, OGRN, СНИЛС, Password, UserCreate

Readme

@frankfmy/validation

ArkType validation schemas for TypeScript

Installation

bun add @frankfmy/validation arktype

Features

Basic Validators

import { Email, URL, UUID, PhoneRU } from '@frankfmy/validation';

// Email validation
const emailResult = Email('[email protected]');
if (emailResult instanceof Error) {
  console.error(emailResult.message);
}

// URL validation
const urlResult = URL('https://example.com');

// UUID validation
const uuidResult = UUID('550e8400-e29b-41d4-a716-446655440000');

// Russian phone number
const phoneResult = PhoneRU('+79161234567');

Russian Business Validators

import { INN, OGRN, SNILS, PassportRU } from '@frankfmy/validation';

// ИНН (Taxpayer Identification Number)
const innResult = INN('7707083893'); // 10 digits for organizations
const innResult2 = INN('500100732259'); // 12 digits for individuals

// ОГРН (Primary State Registration Number)
const ogrnResult = OGRN('1027700132195');

// СНИЛС (Insurance Number)
const snilsResult = SNILS('11223344595');

// Russian Passport
const passportResult = PassportRU({
  series: '4510',
  number: '123456',
  issueDate: '2020-01-15',
  issueAuthority: 'ОВД Москвы',
  divisionCode: '770-001'
});

Password Validation

import { PasswordStrong } from '@frankfmy/validation';

// Strong password requirements:
// - At least 8 characters
// - Contains uppercase letter
// - Contains lowercase letter
// - Contains number
// - Contains special character

const passwordResult = PasswordStrong('MyP@ssw0rd!');

Money & Numbers

import { Money, Percent, TenderBudget } from '@frankfmy/validation';

// Money (non-negative number)
const moneyResult = Money(1234.56);

// Percent (0-100)
const percentResult = Percent(75.5);

// Tender budget
const budgetResult = TenderBudget(1000000);

User Schemas

import { UserCreate } from '@frankfmy/validation';

const userResult = UserCreate({
  email: '[email protected]',
  phone: '+79161234567',
  password: 'MyP@ssw0rd!',
  firstName: 'Иван',
  lastName: 'Иванов',
  middleName: 'Петрович' // optional
});

if (userResult instanceof Error) {
  // Handle validation errors
  console.error(userResult.message);
} else {
  // userResult is typed { email, phone, password, firstName, lastName, middleName? }
  createUser(userResult);
}

Usage with ElysiaJS

import { Elysia, t } from 'elysia';
import { Email, PhoneRU, PasswordStrong } from '@frankfmy/validation';

const app = new Elysia()
  .post('/register', async ({ body }) => {
    // Validate with ArkType
    const emailValid = Email(body.email);
    const phoneValid = PhoneRU(body.phone);
    const passwordValid = PasswordStrong(body.password);
    
    if (emailValid instanceof Error) {
      throw new Error('Invalid email');
    }
    // ... continue registration
  }, {
    body: t.Object({
      email: t.String(),
      phone: t.String(),
      password: t.String()
    })
  });

Custom Validators

import { type } from 'arktype';
import { validateINN, validatePhoneRU } from '@frankfmy/core';

// Create custom ArkType validator
const CustomINN = type('string', {
  validator: (s: string) => validateINN(s) || 'Invalid INN format'
});

// Combine validators
const CompanyData = type({
  name: 'string>3',
  inn: CustomINN,
  email: 'string.email',
  phone: PhoneRU
});

License

PolyForm Shield 1.0.0 — © 2025 Artyom Pryanishnikov