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

text-lower-case

v1.2.10

Published

Convert text to all lowercase letters

Readme

Lower Case

NPM version NPM downloads Bundle size License: MIT TypeScript

Transform text to lowercase format - all characters converted to lowercase.

🚀 Features

  • Lightweight - Only ~200B minified + gzipped
  • Type-safe - Full TypeScript support with comprehensive type definitions
  • Zero dependencies - No external dependencies
  • Tree-shakeable - ES modules support
  • Universal - Works in browsers, Node.js, and serverless environments
  • Well-tested - Comprehensive test suite with edge cases

📦 Installation

# npm
npm install text-lower-case

# yarn
yarn add text-lower-case

# pnpm
pnpm add text-lower-case

# bun
bun add text-lower-case

🎯 Quick Start

import { lowerCase } from "text-lower-case";

console.log(lowerCase("HELLO WORLD")); // "hello world"
console.log(lowerCase("CamelCase")); // "camelcase"
console.log(lowerCase("KEBAB-CASE")); // "kebab-case"

📖 Usage

ES Modules (Recommended)

import { lowerCase } from "text-lower-case";

console.log(lowerCase("HELLO")); // "hello"

CommonJS

const { lowerCase } = require("text-lower-case");

console.log(lowerCase("HELLO")); // "hello"

TypeScript

import { lowerCase } from "text-lower-case";

const result: string = lowerCase("HELLO WORLD");
console.log(result); // "hello world"

🔄 Transformation Examples

Basic Transformations

import { lowerCase } from "text-lower-case";

// Simple cases
lowerCase("HELLO"); // "hello"
lowerCase("WORLD"); // "world"
lowerCase("Hello World"); // "hello world"

// Mixed case
lowerCase("hELLo WoRLD"); // "hello world"
lowerCase("CamelCase"); // "camelcase"
lowerCase("PascalCase"); // "pascalcase"

// Programming cases
lowerCase("SNAKE_CASE"); // "snake_case"
lowerCase("KEBAB-CASE"); // "kebab-case"
lowerCase("DOT.CASE"); // "dot.case"

Edge Cases

import { lowerCase } from "text-lower-case";

// Empty and single character
lowerCase(""); // ""
lowerCase("A"); // "a"
lowerCase("a"); // "a"

// Numbers and symbols
lowerCase("HELLO123"); // "hello123"
lowerCase("[email protected]"); // "[email protected]"
lowerCase("USER-123"); // "user-123"

// Unicode characters
lowerCase("CAFÉ"); // "café"
lowerCase("NAÏVE"); // "naïve"
lowerCase("RÉSUMÉ"); // "résumé"

🌍 Real-World Examples

Email and Username Processing

import { lowerCase } from "text-lower-case";

// Email normalization
lowerCase("[email protected]"); // "[email protected]"
lowerCase("[email protected]"); // "[email protected]"
lowerCase("[email protected]"); // "[email protected]"

// Username normalization
lowerCase("JohnDoe123"); // "johndoe123"
lowerCase("ADMIN_USER"); // "admin_user"
lowerCase("Guest-User"); // "guest-user"

URL and Domain Processing

import { lowerCase } from "text-lower-case";

// Domain normalization
lowerCase("EXAMPLE.COM"); // "example.com"
lowerCase("API.GitHub.Com"); // "api.github.com"
lowerCase("SUB.DOMAIN.ORG"); // "sub.domain.org"

// Protocol normalization
lowerCase("HTTPS"); // "https"
lowerCase("HTTP"); // "http"
lowerCase("FTP"); // "ftp"

Search and Filtering

import { lowerCase } from "text-lower-case";

function searchItems(items, query) {
  const normalizedQuery = lowerCase(query);

  return items.filter(
    (item) =>
      lowerCase(item.name).includes(normalizedQuery) ||
      lowerCase(item.description).includes(normalizedQuery),
  );
}

const products = [
  { name: "iPhone 15", description: "Latest Apple smartphone" },
  { name: "Samsung Galaxy", description: "Android flagship device" },
  { name: "Google Pixel", description: "Pure Android experience" },
];

console.log(searchItems(products, "APPLE"));
// [{ name: "iPhone 15", description: "Latest Apple smartphone" }]

Form Data Processing

import { lowerCase } from "text-lower-case";

function normalizeFormData(formData) {
  const normalized = {};

  for (const [key, value] of Object.entries(formData)) {
    if (typeof value === "string") {
      // Normalize email fields
      if (key.toLowerCase().includes("email")) {
        normalized[key] = lowerCase(value.trim());
      }
      // Normalize username fields
      else if (key.toLowerCase().includes("username")) {
        normalized[key] = lowerCase(value.trim());
      } else {
        normalized[key] = value;
      }
    } else {
      normalized[key] = value;
    }
  }

  return normalized;
}

const formData = {
  email: "  [email protected]  ",
  username: "JOHNDOE123",
  firstName: "John",
  lastName: "Doe",
};

console.log(normalizeFormData(formData));
// {
//   email: "[email protected]",
//   username: "johndoe123",
//   firstName: "John",
//   lastName: "Doe"
// }

Database Query Normalization

import { lowerCase } from "text-lower-case";

class UserRepository {
  async findByEmail(email) {
    const normalizedEmail = lowerCase(email.trim());
    return await this.db.users.findOne({
      email: normalizedEmail,
    });
  }

  async findByUsername(username) {
    const normalizedUsername = lowerCase(username.trim());
    return await this.db.users.findOne({
      username: normalizedUsername,
    });
  }

  async searchUsers(query) {
    const normalizedQuery = lowerCase(query);
    return await this.db.users.find({
      $or: [
        { email: { $regex: normalizedQuery, $options: "i" } },
        { username: { $regex: normalizedQuery, $options: "i" } },
      ],
    });
  }
}

Configuration Management

import { lowerCase } from "text-lower-case";

function parseEnvironmentVariables(env) {
  const config = {};

  for (const [key, value] of Object.entries(env)) {
    // Normalize boolean values
    if (typeof value === "string") {
      const lowerValue = lowerCase(value);

      if (lowerValue === "true" || lowerValue === "false") {
        config[key] = lowerValue === "true";
      }
      // Normalize protocol values
      else if (key.toLowerCase().includes("protocol")) {
        config[key] = lowerValue;
      }
      // Normalize host values
      else if (key.toLowerCase().includes("host")) {
        config[key] = lowerValue;
      } else {
        config[key] = value;
      }
    } else {
      config[key] = value;
    }
  }

  return config;
}

const env = {
  NODE_ENV: "PRODUCTION",
  DATABASE_HOST: "LOCALHOST",
  USE_SSL: "TRUE",
  PROTOCOL: "HTTPS",
};

console.log(parseEnvironmentVariables(env));
// {
//   NODE_ENV: "PRODUCTION",
//   DATABASE_HOST: "localhost",
//   USE_SSL: true,
//   PROTOCOL: "https"
// }

Text Processing Pipeline

import { lowerCase } from "text-lower-case";

class TextNormalizer {
  constructor() {
    this.processors = [];
  }

  addTrim() {
    this.processors.push((text) => text.trim());
    return this;
  }

  addLowerCase() {
    this.processors.push(lowerCase);
    return this;
  }

  addRemoveExtraSpaces() {
    this.processors.push((text) => text.replace(/\s+/g, " "));
    return this;
  }

  process(text) {
    return this.processors.reduce(
      (result, processor) => processor(result),
      text,
    );
  }
}

const normalizer = new TextNormalizer()
  .addTrim()
  .addLowerCase()
  .addRemoveExtraSpaces();

console.log(normalizer.process("  HELLO    WORLD  ")); // "hello world"

API Response Processing

import { lowerCase } from "text-lower-case";

function normalizeApiResponse(response) {
  if (response.data && Array.isArray(response.data)) {
    response.data = response.data.map((item) => {
      if (item.email) {
        item.email = lowerCase(item.email);
      }
      if (item.username) {
        item.username = lowerCase(item.username);
      }
      if (item.status) {
        item.status = lowerCase(item.status);
      }
      return item;
    });
  }

  return response;
}

const apiResponse = {
  success: true,
  data: [
    { id: 1, email: "[email protected]", username: "JOHNDOE", status: "ACTIVE" },
    {
      id: 2,
      email: "[email protected]",
      username: "ADMIN",
      status: "INACTIVE",
    },
  ],
};

console.log(normalizeApiResponse(apiResponse));
// {
//   success: true,
//   data: [
//     { id: 1, email: "[email protected]", username: "johndoe", status: "active" },
//     { id: 2, email: "[email protected]", username: "admin", status: "inactive" }
//   ]
// }

📖 API Reference

lowerCase(input)

Converts a string to lowercase format.

Parameters

  • input (string): The string to transform

Returns

  • string: The string converted to lowercase

📊 Bundle Size

This package is optimized for minimal bundle size:

  • Minified: ~200B
  • Gzipped: ~150B
  • Tree-shakeable: Yes
  • Side effects: None

🌍 Browser Support

  • Modern browsers: ES2015+ (Chrome 51+, Firefox 54+, Safari 10+)
  • Node.js: 12+
  • TypeScript: 4.0+
  • Bundle formats: UMD, ESM, CommonJS

🧪 Testing

# Run tests
pnpm test

# Run tests in watch mode
pnpm test --watch

# Run tests with coverage
pnpm test --coverage

# Type checking
pnpm typecheck

# Linting
pnpm lint

🔗 Related Packages

📜 License

MIT © Dmitry Selikhov

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

🆘 Support


Made with ❤️ by Dmitry Selikhov