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

utilitify-core

v1.0.0

Published

Comprehensive validation & utility SDK for JavaScript/TypeScript - User data validation, country utilities, string helpers, security, and more.

Readme

Utilitify

Comprehensive validation & utility SDK for JavaScript/TypeScript applications

npm version License: MIT TypeScript

Features

  • Security - Password strength, hashing, secure tokens
  • Validators - Email, phone, username, URL, credit card, IBAN, VAT, IP
  • Country Data - Countries, timezones, currencies, dialing codes
  • String Utils - Case conversion, slugs, masking, truncation
  • Date Utils - Age calculation, formatting, validation
  • Transform - Deep merge, flatten, sanitization
  • Form Validation - Field validators, conditional rules
  • Tree-Shakable - Import only what you need
  • Zero Dependencies - Lightweight core
  • TypeScript Native - Full type safety

Installation

npm install utilitify-core

Optional (for bcrypt hashing):

npm install bcryptjs

Quick Start

import { validateEmail } from 'utilitify-core/validators';
import { checkPasswordStrength } from 'utilitify-core/security';
import { slugify } from 'utilitify-core/string';

// Email validation
const email = validateEmail('[email protected]');
console.log(email.isValid); // true

// Password strength
const password = checkPasswordStrength('MyP@ssw0rd123');
console.log(password.score); // 0-4
console.log(password.crackTime); // "Centuries"

// String utilities
const slug = slugify('Hello World!'); // "hello-world"

API Reference

Validators (utilitify-core/validators)

// Email
validateEmail(email, options?)
isValidEmail(email)
isDisposableEmail(email)
normalizeEmail(email)

// Phone
validatePhone(phone, country?)
formatPhone(phone, country?)

// Username
validateUsername(username, options?)
suggestUsernames(base)

// URL
validateUrl(url, options?)
isDangerousUrl(url)

// Credit Card
validateCreditCard(number)
detectCardType(number)

// Financial
validateIBAN(iban)
validateVAT(vat, country)

// IP Address
validateIp(ip, options?)
isPrivateIp(ip)

Security (utilitify-core/security)

// Password
checkPasswordStrength(password, options?)
isStrongPassword(password, minScore?)
getPasswordFeedback(password)

// Hashing
hashSHA256(data)
hashSHA512(data)
hashBcrypt(password, rounds?)
verifyBcrypt(password, hash)
hmacSHA256(data, key)

// Tokens
generateUUID()
generateUUIDv7()
generateToken(length)
generateSecureToken(length)
generateNanoId(length?)

String (utilitify-core/string)

// Case conversion
toCamelCase(str)
toPascalCase(str)
toSnakeCase(str)
toKebabCase(str)
toTitleCase(str)

// Slugs
slugify(str, options?)
uniqueSlug(str, existing)

// Masking
maskEmail(email)
maskPhone(phone)
maskCreditCard(number)

// Random
generatePassword(options?)
generateOTP(length?)

// Truncation
truncate(str, length, options?)
truncateWords(str, words)

Country (utilitify-core/country)

// Country lookup
getCountry(code)
getAllCountries()
searchCountries(query)

// Timezone
getTimezonesByCountry(country)
getCurrentTimeInCountry(country)

// Currency
getCurrencyByCountry(country)
formatCurrency(amount, currency)

// Flags & Dialing
getFlagEmoji(country)
getDialingCode(country)

Date (utilitify-core/date)

// Age
calculateAge(birthDate)
isAdult(birthDate, minAge?)
getAgeBracket(age)

// Formatting
formatRelativeTime(date)
formatDate(date, format)

// Validation
isValidDate(date)
isInPast(date)
isWeekend(date)

// Time difference
getTimeDiff(date1, date2)
addTime(date, amount, unit)

Transform (utilitify-core/transform)

// Objects
deepMerge(obj1, obj2)
cloneDeep(obj)
flattenObject(obj)
pick(obj, keys)
omit(obj, keys)

// Sanitization
sanitizeString(str)
stripHtml(html)
escapeHtml(str)

Form (utilitify-core/form)

// Validators
required(value)
minLength(value, min)
maxLength(value, max)
matchesPattern(value, pattern)

// Conditional
requiredIf(value, condition)
mustMatch(value, other)

Schema (utilitify-core/schema)

import { z } from 'utilitify-core/schema';

const schema = z.object({
  email: z.string().email(),
  age: z.number().min(18).max(120),
  name: z.string().min(2)
});

const result = schema.safeParse(data);
if (result.success) {
  console.log(result.data);
}

Usage Examples

Form Validation

import { validateEmail, validatePhone, checkPasswordStrength } from 'utilitify-core';

function validateForm(data) {
  const errors = {};

  const email = validateEmail(data.email, { checkDisposable: true });
  if (!email.isValid) {
    errors.email = email.errors[0].message;
  }

  const phone = validatePhone(data.phone, 'US');
  if (!phone.isValid) {
    errors.phone = 'Invalid phone number';
  }

  const password = checkPasswordStrength(data.password);
  if (password.score < 3) {
    errors.password = password.suggestions.join(', ');
  }

  return { isValid: Object.keys(errors).length === 0, errors };
}

Secure Token Generation

import { generateUUID, generateSecureToken } from 'utilitify-core/security';

const userId = generateUUID();
const apiKey = generateSecureToken(32);
const sessionToken = generateSecureToken(64);

International Phone Formatting

import { formatPhone, getDialingCode } from 'utilitify-core/country';

const formatted = formatPhone('2025551234', 'US');
// "+1 (202) 555-1234"

const code = getDialingCode('GB');
// "+44"

String Manipulation

import { slugify, maskEmail, truncate } from 'utilitify-core/string';

slugify('Hello World! 123'); // "hello-world-123"
maskEmail('[email protected]'); // "u***@example.com"
truncate('Long text...', 10); // "Long te..."

Tree-Shaking

Import from specific paths to reduce bundle size:

// Recommended - Only imports what you need
import { validateEmail } from 'utilitify-core/validators';
import { generateUUID } from 'utilitify-core/security';

// Avoid - Imports entire package
import { validateEmail, generateUUID } from 'utilitify-core';

TypeScript Support

Full TypeScript support with type definitions:

import type { 
  EmailValidationResult, 
  PasswordStrength,
  Country 
} from 'utilitify-core';

const result: EmailValidationResult = validateEmail('[email protected]');

Browser & Node.js Support

  • Node.js: >= 18.0.0
  • Browsers: All modern browsers (ES2022+)
  • TypeScript: >= 5.0

Bundle Size

  • Core validators: ~5 KB (gzipped)
  • Full package: ~10 KB (gzipped)
  • Tree-shakable modules

License

MIT © Fahad

Links