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

text-is-lower-case

v1.2.9

Published

Returns `true` if text is lower case only

Readme

Is Lower Case

NPM version NPM downloads Bundle size License: MIT TypeScript

Check if a string is in lowercase format.

🚀 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-is-lower-case

# yarn
yarn add text-is-lower-case

# pnpm
pnpm add text-is-lower-case

# bun
bun add text-is-lower-case

🎯 Quick Start

import { isLowerCase } from "text-is-lower-case";

console.log(isLowerCase("hello world")); // true
console.log(isLowerCase("Hello World")); // false
console.log(isLowerCase("HELLO WORLD")); // false

📖 Usage

ES Modules (Recommended)

import { isLowerCase } from "text-is-lower-case";

console.log(isLowerCase("hello")); // true

CommonJS

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

console.log(isLowerCase("hello")); // true

TypeScript

import { isLowerCase } from "text-is-lower-case";

const result: boolean = isLowerCase("hello world");
console.log(result); // true

🔄 Validation Examples

Basic Validation

import { isLowerCase } from "text-is-lower-case";

// Valid lowercase
isLowerCase("hello"); // true
isLowerCase("hello world"); // true
isLowerCase("test123"); // true
isLowerCase("user_name"); // true
isLowerCase("api-key"); // true

// Invalid (not lowercase)
isLowerCase("Hello"); // false
isLowerCase("HELLO"); // false
isLowerCase("Hello World"); // false
isLowerCase("camelCase"); // false
isLowerCase("PascalCase"); // false

Edge Cases

import { isLowerCase } from "text-is-lower-case";

// Numbers and symbols
isLowerCase("123"); // true
isLowerCase("hello123"); // true
isLowerCase("[email protected]"); // true
isLowerCase("user_123"); // true

// Empty and whitespace
isLowerCase(""); // true
isLowerCase("   "); // true
isLowerCase("\n\t"); // true

// Special characters
isLowerCase("hello-world"); // true
isLowerCase("test_case"); // true
isLowerCase("file.txt"); // true

🌍 Real-World Examples

Form Validation

import { isLowerCase } from "text-is-lower-case";

function validateUsername(username) {
  if (!isLowerCase(username)) {
    return "Username must be lowercase";
  }
  return null;
}

console.log(validateUsername("john_doe")); // null (valid)
console.log(validateUsername("John_Doe")); // "Username must be lowercase"

Email Validation

import { isLowerCase } from "text-is-lower-case";

function validateEmailFormat(email) {
  const [localPart] = email.split("@");

  if (!isLowerCase(localPart)) {
    return "Email local part should be lowercase";
  }
  return null;
}

console.log(validateEmailFormat("[email protected]")); // null
console.log(validateEmailFormat("[email protected]")); // "Email local part should be lowercase"

URL Slug Validation

import { isLowerCase } from "text-is-lower-case";

function validateSlug(slug) {
  if (!isLowerCase(slug)) {
    return "URL slug must be lowercase";
  }
  return null;
}

console.log(validateSlug("my-blog-post")); // null
console.log(validateSlug("My-Blog-Post")); // "URL slug must be lowercase"

Configuration Validation

import { isLowerCase } from "text-is-lower-case";

function validateConfigKeys(config) {
  const invalidKeys = Object.keys(config).filter((key) => !isLowerCase(key));

  if (invalidKeys.length > 0) {
    return `Invalid config keys (must be lowercase): ${invalidKeys.join(", ")}`;
  }
  return null;
}

const config1 = { database_url: "...", api_key: "..." };
const config2 = { databaseUrl: "...", apiKey: "..." };

console.log(validateConfigKeys(config1)); // null
console.log(validateConfigKeys(config2)); // "Invalid config keys..."

📖 API Reference

isLowerCase(input)

Checks if a string is in lowercase format.

Parameters

  • input (string): The string to check

Returns

  • boolean: true if the string is lowercase, false otherwise

📊 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