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-first

v1.2.10

Published

Convert text with only the first character in lower case

Downloads

201,505

Readme

Lower Case First

NPM version NPM downloads Bundle size License: MIT TypeScript

Transform text by making the first character lowercase while preserving the rest.

🚀 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-first

# yarn
yarn add text-lower-case-first

# pnpm
pnpm add text-lower-case-first

# bun
bun add text-lower-case-first

🎯 Quick Start

import { lowerCaseFirst } from "text-lower-case-first";

console.log(lowerCaseFirst("Hello World")); // "hello World"
console.log(lowerCaseFirst("HELLO WORLD")); // "hELLO WORLD"
console.log(lowerCaseFirst("CamelCase")); // "camelCase"

📖 Usage

ES Modules (Recommended)

import { lowerCaseFirst } from "text-lower-case-first";

console.log(lowerCaseFirst("Hello")); // "hello"

CommonJS

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

console.log(lowerCaseFirst("Hello")); // "hello"

TypeScript

import { lowerCaseFirst } from "text-lower-case-first";

const result: string = lowerCaseFirst("Hello World");
console.log(result); // "hello World"

🔄 Transformation Examples

Basic Transformations

import { lowerCaseFirst } from "text-lower-case-first";

// Simple cases
lowerCaseFirst("Hello"); // "hello"
lowerCaseFirst("hello"); // "hello"
lowerCaseFirst("HELLO"); // "hELLO"

// Multiple words
lowerCaseFirst("Hello World"); // "hello World"
lowerCaseFirst("HELLO WORLD"); // "hELLO WORLD"
lowerCaseFirst("hello world"); // "hello world"

// Programming cases
lowerCaseFirst("CamelCase"); // "camelCase"
lowerCaseFirst("PascalCase"); // "pascalCase"
lowerCaseFirst("Snake_case"); // "snake_case"
lowerCaseFirst("Kebab-case"); // "kebab-case"

Edge Cases

import { lowerCaseFirst } from "text-lower-case-first";

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

// Numbers and symbols
lowerCaseFirst("123hello"); // "123hello"
lowerCaseFirst("@Hello"); // "@Hello"
lowerCaseFirst("Hello123"); // "hello123"

// Unicode characters
lowerCaseFirst("Ñice"); // "ñice"
lowerCaseFirst("Über"); // "über"
lowerCaseFirst("Café"); // "café"

🌍 Real-World Examples

Variable Name Conversion

import { lowerCaseFirst } from "text-lower-case-first";

// Convert PascalCase to camelCase
lowerCaseFirst("UserProfile"); // "userProfile"
lowerCaseFirst("DatabaseConnection"); // "databaseConnection"
lowerCaseFirst("ApiResponse"); // "apiResponse"
lowerCaseFirst("HttpClient"); // "httpClient"

JSON Property Processing

import { lowerCaseFirst } from "text-lower-case-first";

function convertObjectKeys(obj) {
  const converted = {};

  for (const [key, value] of Object.entries(obj)) {
    const newKey = lowerCaseFirst(key);
    converted[newKey] =
      typeof value === "object" && value !== null
        ? convertObjectKeys(value)
        : value;
  }

  return converted;
}

const apiResponse = {
  UserName: "john_doe",
  EmailAddress: "[email protected]",
  ProfileData: {
    FirstName: "John",
    LastName: "Doe",
    PhoneNumber: "123-456-7890",
  },
};

console.log(convertObjectKeys(apiResponse));
// {
//   userName: "john_doe",
//   emailAddress: "[email protected]",
//   profileData: {
//     firstName: "John",
//     lastName: "Doe",
//     phoneNumber: "123-456-7890"
//   }
// }

Class Method Generation

import { lowerCaseFirst } from "text-lower-case-first";

function createGetter(propertyName) {
  const methodName = `get${propertyName}`;
  return lowerCaseFirst(methodName);
}

function createSetter(propertyName) {
  const methodName = `set${propertyName}`;
  return lowerCaseFirst(methodName);
}

console.log(createGetter("UserName")); // "getUserName"
console.log(createSetter("EmailAddress")); // "setEmailAddress"
console.log(createGetter("IsActive")); // "getIsActive"

Form Field Processing

import { lowerCaseFirst } from "text-lower-case-first";

function processFormFields(fields) {
  const processed = {};

  fields.forEach((field) => {
    // Convert field names to camelCase
    const fieldName = lowerCaseFirst(field.Name || field.name);
    processed[fieldName] = {
      value: field.Value || field.value || "",
      required: field.Required || field.required || false,
      type: field.Type || field.type || "text",
    };
  });

  return processed;
}

const formFields = [
  { Name: "FirstName", Value: "John", Required: true, Type: "text" },
  { Name: "LastName", Value: "Doe", Required: true, Type: "text" },
  { Name: "EmailAddress", Value: "", Required: true, Type: "email" },
];

console.log(processFormFields(formFields));
// {
//   firstName: { value: "John", required: true, type: "text" },
//   lastName: { value: "Doe", required: true, type: "text" },
//   emailAddress: { value: "", required: true, type: "email" }
// }

API Response Normalization

import { lowerCaseFirst } from "text-lower-case-first";

function normalizeApiResponse(response) {
  if (Array.isArray(response)) {
    return response.map(normalizeApiResponse);
  }

  if (typeof response === "object" && response !== null) {
    const normalized = {};

    for (const [key, value] of Object.entries(response)) {
      const normalizedKey = lowerCaseFirst(key);
      normalized[normalizedKey] = normalizeApiResponse(value);
    }

    return normalized;
  }

  return response;
}

const apiData = {
  UserId: 123,
  UserName: "john_doe",
  ProfileInfo: {
    FirstName: "John",
    LastName: "Doe",
    ContactDetails: {
      EmailAddress: "[email protected]",
      PhoneNumber: "123-456-7890",
    },
  },
  Preferences: [
    { SettingName: "theme", SettingValue: "dark" },
    { SettingName: "language", SettingValue: "en" },
  ],
};

console.log(normalizeApiResponse(apiData));
// {
//   userId: 123,
//   userName: "john_doe",
//   profileInfo: {
//     firstName: "John",
//     lastName: "Doe",
//     contactDetails: {
//       emailAddress: "[email protected]",
//       phoneNumber: "123-456-7890"
//     }
//   },
//   preferences: [
//     { settingName: "theme", settingValue: "dark" },
//     { settingName: "language", settingValue: "en" }
//   ]
// }

Code Generation

import { lowerCaseFirst } from "text-lower-case-first";

class CodeGenerator {
  generateProperty(name, type = "string") {
    const propertyName = lowerCaseFirst(name);
    return `private ${propertyName}: ${type};`;
  }

  generateGetter(name, type = "string") {
    const propertyName = lowerCaseFirst(name);
    const methodName = `get${name}`;
    return `public ${lowerCaseFirst(methodName)}(): ${type} {
      return this.${propertyName};
    }`;
  }

  generateSetter(name, type = "string") {
    const propertyName = lowerCaseFirst(name);
    const methodName = `set${name}`;
    const paramName = lowerCaseFirst(name);
    return `public ${lowerCaseFirst(methodName)}(${paramName}: ${type}): void {
      this.${propertyName} = ${paramName};
    }`;
  }
}

const generator = new CodeGenerator();
console.log(generator.generateProperty("UserName"));
// "private userName: string;"

console.log(generator.generateGetter("UserName"));
// "public getUserName(): string {
//   return this.userName;
// }"

Configuration Processing

import { lowerCaseFirst } from "text-lower-case-first";

function processConfiguration(config) {
  const processed = {};

  for (const [section, settings] of Object.entries(config)) {
    const sectionName = lowerCaseFirst(section);
    processed[sectionName] = {};

    for (const [key, value] of Object.entries(settings)) {
      const settingName = lowerCaseFirst(key);
      processed[sectionName][settingName] = value;
    }
  }

  return processed;
}

const appConfig = {
  DatabaseSettings: {
    ConnectionString: "localhost:5432",
    MaxConnections: 100,
    TimeoutSeconds: 30,
  },
  ApiSettings: {
    BaseUrl: "https://api.example.com",
    ApiKey: "secret-key",
    RateLimitPerMinute: 1000,
  },
};

console.log(processConfiguration(appConfig));
// {
//   databaseSettings: {
//     connectionString: "localhost:5432",
//     maxConnections: 100,
//     timeoutSeconds: 30
//   },
//   apiSettings: {
//     baseUrl: "https://api.example.com",
//     apiKey: "secret-key",
//     rateLimitPerMinute: 1000
//   }
// }

📖 API Reference

lowerCaseFirst(input)

Makes the first character of a string lowercase while preserving the rest.

Parameters

  • input (string): The string to transform

Returns

  • string: The string with the first character in 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