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-no-case

v1.2.9

Published

Convert text to all lowercase letters with spaces between words

Readme

No Case

NPM version NPM downloads Bundle size License: MIT TypeScript

Transform text into no case format where words are lowercase and separated by spaces.

🚀 Features

  • Lightweight - Only ~450B 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
  • Customizable - Flexible options for advanced use cases

📦 Installation

# npm
npm install text-no-case

# yarn
yarn add text-no-case

# pnpm
pnpm add text-no-case

# bun
bun add text-no-case

🎯 Quick Start

import { noCase } from "text-no-case";

console.log(noCase("hello world")); // "hello world"
console.log(noCase("userProfileData")); // "user profile data"
console.log(noCase("backgroundColor")); // "background color"

📖 Usage

ES Modules (Recommended)

import { noCase } from "text-no-case";

console.log(noCase("hello world")); // "hello world"

CommonJS

const { noCase } = require("text-no-case");

console.log(noCase("hello world")); // "hello world"

TypeScript

import { noCase, Options } from "text-no-case";

const result: string = noCase("hello world");
console.log(result); // "hello world"

🔄 Transformation Examples

Basic Transformations

import { noCase } from "text-no-case";

// From different cases
noCase("hello world"); // "hello world"
noCase("Hello World"); // "hello world"
noCase("HELLO WORLD"); // "hello world"
noCase("camelCase"); // "camel case"
noCase("PascalCase"); // "pascal case"
noCase("snake_case"); // "snake case"
noCase("kebab-case"); // "kebab case"
noCase("dot.case"); // "dot case"

// Complex examples
noCase("XMLHttpRequest"); // "xml http request"
noCase("iPhone"); // "i phone"
noCase("version 1.2.3"); // "version 1 2 3"
noCase("userProfileData"); // "user profile data"

Advanced Options

import { noCase } from "text-no-case";

// Custom word splitting
noCase("XMLHttpRequest", {
  splitRegexp: /([a-z])([A-Z])/g,
}); // "xml http request"

// Custom character stripping
noCase("[email protected]", {
  stripRegexp: /[@.]/g,
}); // "hello world com"

// Custom transformation function
noCase("api-v2-endpoint", {
  transform: (word, index) => {
    if (word === "api") return "api";
    if (word === "v2") return "version 2";
    return word.toLowerCase();
  },
}); // "api version 2 endpoint"

🌍 Real-World Examples

Search Query Processing

import { noCase } from "text-no-case";

// Normalize search queries
noCase("JavaScript"); // "java script"
noCase("ReactJS"); // "react js"
noCase("Node.js"); // "node js"
noCase("TypeScript"); // "type script"
noCase("MongoDB"); // "mongo db"

Content Processing

import { noCase } from "text-no-case";

// Process content for readability
noCase("userManagement"); // "user management"
noCase("dataVisualization"); // "data visualization"
noCase("apiIntegration"); // "api integration"
noCase("errorHandling"); // "error handling"
noCase("performanceOptimization"); // "performance optimization"

Tag Processing

import { noCase } from "text-no-case";

// Convert tags to readable format
const tags = [
  "webDevelopment",
  "machineLearning",
  "dataScience",
  "userExperience",
  "projectManagement",
];

const readableTags = tags.map(noCase);
console.log(readableTags);
// [
//   "web development",
//   "machine learning",
//   "data science",
//   "user experience",
//   "project management"
// ]

Form Label Generation

import { noCase } from "text-no-case";

function generateFormLabel(fieldName) {
  return noCase(fieldName)
    .split(" ")
    .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
    .join(" ");
}

console.log(generateFormLabel("firstName")); // "First Name"
console.log(generateFormLabel("emailAddress")); // "Email Address"
console.log(generateFormLabel("phoneNumber")); // "Phone Number"

URL Slug Preparation

import { noCase } from "text-no-case";

function prepareSlug(title) {
  return noCase(title)
    .replace(/\s+/g, "-")
    .replace(/[^a-z0-9-]/g, "");
}

console.log(prepareSlug("Hello World!")); // "hello-world"
console.log(prepareSlug("JavaScript Tips & Tricks")); // "java-script-tips-tricks"

Text Analysis

import { noCase } from "text-no-case";

function analyzeText(text) {
  const normalized = noCase(text);
  const words = normalized.split(" ").filter((word) => word.length > 0);

  return {
    wordCount: words.length,
    uniqueWords: [...new Set(words)].length,
    averageWordLength:
      words.reduce((sum, word) => sum + word.length, 0) / words.length,
  };
}

console.log(analyzeText("userProfileData"));
// { wordCount: 3, uniqueWords: 3, averageWordLength: 4.67 }

Content Normalization

import { noCase } from "text-no-case";

function normalizeContent(content) {
  return content
    .split("\n")
    .map((line) => line.trim())
    .filter((line) => line.length > 0)
    .map((line) => noCase(line))
    .join(" ");
}

const content = `
  userManagement
  dataVisualization
  apiIntegration
`;

console.log(normalizeContent(content));
// "user management data visualization api integration"

Keyword Extraction

import { noCase } from "text-no-case";

function extractKeywords(text, minLength = 3) {
  const normalized = noCase(text);
  const words = normalized.split(" ");

  return words
    .filter((word) => word.length >= minLength)
    .filter((word, index, arr) => arr.indexOf(word) === index)
    .sort();
}

console.log(extractKeywords("userProfileDataManagement"));
// ["data", "management", "profile", "user"]

📖 API Reference

noCase(input, options?)

Converts a string to no case format.

Parameters

  • input (string): The string to convert
  • options (Options, optional): Configuration options

Returns

  • string: The no case formatted string

Options

interface Options {
  // Custom transform function for word processing
  transform?: (word: string, index: number, words: string[]) => string;

  // Regex to strip characters before processing
  stripRegexp?: RegExp;

  // Custom split function
  split?: (value: string) => string[];
}

🔧 Advanced Configuration

Custom Word Splitting

import { noCase } from "text-no-case";

// Split on specific patterns
noCase("XMLHttpRequest", {
  splitRegexp: /([a-z])([A-Z])/g,
}); // "xml http request"

// Split on numbers
noCase("user123data", {
  splitRegexp: /([a-zA-Z])(\d)/g,
}); // "user 123 data"

Custom Character Stripping

import { noCase } from "text-no-case";

// Strip specific characters
noCase("[email protected]", {
  stripRegexp: /[@.]/g,
}); // "hello world com"

// Strip all non-alphanumeric
noCase("hello!@#world", {
  stripRegexp: /[^a-zA-Z0-9]/g,
}); // "hello world"

Custom Transform Functions

import { noCase } from "text-no-case";

// Preserve certain words
noCase("xml-http-request", {
  transform: (word, index) => {
    const preserveWords = ["xml", "http", "api", "url"];
    if (preserveWords.includes(word.toLowerCase())) {
      return word.toLowerCase();
    }
    return word.toLowerCase();
  },
}); // "xml http request"

// Custom business logic
noCase("user-v2-api", {
  transform: (word, index) => {
    if (word === "v2") return "version 2";
    if (word === "api") return "api";
    return word.toLowerCase();
  },
}); // "user version 2 api"

📊 Bundle Size

This package is optimized for minimal bundle size:

  • Minified: ~450B
  • Gzipped: ~250B
  • 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