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

textkit-lite

v1.0.2

Published

Lightweight text processing utilities for Node.js with zero dependencies.

Readme

textkit-lite

A lightweight, zero-dependency Node.js string utility package built with CommonJS. Provides simple, fast, and reliable text transformations.

Features

  • ⚡ Zero dependencies: Pure JavaScript using Node.js standard runtime.
  • 📦 CommonJS compatible: Works seamlessly with standard require.
  • 🧪 Built-in test suite: Uses Node's native node:test runner.
  • 🛡️ Edge-case friendly: Safe handling of empty, null, or undefined values.

Install

Install via npm:

npm install textkit-lite

Usage

You can import the entire suite or destructure individual utilities:

const {
  slugify,
  capitalize,
  truncate,
  wordCount,
  isPalindrome
} = require('textkit-lite');

// Slugify
console.log(slugify('Hello World! 2026')); // "hello-world-2026"

// Capitalize
console.log(capitalize('hello world')); // "Hello world"

// Truncate
console.log(truncate('The quick brown fox jumps over the lazy dog', 20)); // "The quick brown f..."

// Word Count
console.log(wordCount('Count words easily in this sentence.')); // 6

// Palindrome check
console.log(isPalindrome('A man, a plan, a canal: Panama')); // true

You can also import functions individually from src/:

const slugify = require('textkit-lite/src/slugify');

API

slugify(str, [options])

Converts a string into a clean, URL-friendly slug. Removes accents/diacritics and replaces non-alphanumeric characters with a separator.

  • Parameters:
    • str (string): The string to convert.
    • options (Object, optional):
      • separator (string, default: '-'): Character used to join words.
      • lowercase (boolean, default: true): Whether to convert output to lowercase.
  • Returns: string - The slugified string (or "" if input is invalid).
slugify('Crème Brûlée & Apple Pie');
// Output: "creme-brulee-apple-pie"

slugify('Hello World', { separator: '_' });
// Output: "hello_world"

slugify('Hello World', { lowercase: false });
// Output: "Hello-World"

capitalize(str, [options])

Capitalizes the first character of a string.

  • Parameters:
    • str (string): The string to capitalize.
    • options (Object | boolean, optional):
      • lowerRest (boolean, default: false): If true, transforms remaining characters to lowercase. Can also be passed as a boolean directly.
  • Returns: string - The capitalized string (or "" if input is invalid).
capitalize('hello world');
// Output: "Hello world"

capitalize('hELLO WORLD', { lowerRest: true });
// Output: "Hello world"

truncate(str, [length], [options])

Truncates a string if it exceeds a specified length, appending an omission indicator.

  • Parameters:
    • str (string): The string to truncate.
    • length (number | Object, default: 30): Maximum length of the output string (including omission), or options object.
    • options (Object | string, optional):
      • omission (string, default: '...'): Indicator appended to truncated strings. Can also be passed as a string directly.
  • Returns: string - The truncated string.
truncate('Hello World!', 8);
// Output: "Hello..."

truncate('Hello World!', 8, '[..]');
// Output: "Hell[..]"

truncate('Hello World!', { length: 10, omission: '…' });
// Output: "Hello Wor…"

wordCount(str)

Counts the number of words separated by whitespace in a string.

  • Parameters:
    • str (string): The string to count words in.
  • Returns: number - Number of words.
wordCount('The quick brown fox');
// Output: 4

wordCount('   Multiple    spaces and \n newlines   ');
// Output: 5

wordCount('');
// Output: 0

isPalindrome(str, [options])

Checks whether a string reads the same forwards and backwards. By default, it ignores casing, whitespace, and punctuation.

  • Parameters:
    • str (string): The string to check.
    • options (Object, optional):
      • caseSensitive (boolean, default: false): Whether case matters.
      • ignoreWhitespace (boolean, default: true): Whether whitespace is ignored.
      • ignorePunctuation (boolean, default: true): Whether punctuation and symbols are ignored.
  • Returns: boolean - true if palindrome, false otherwise.
isPalindrome('racecar');
// Output: true

isPalindrome('A man, a plan, a canal: Panama');
// Output: true

isPalindrome('Racecar', { caseSensitive: true });
// Output: false

isPalindrome('race car', { ignoreWhitespace: false });
// Output: false

Testing

Run tests with Node.js built-in test runner:

npm test

License

MIT © 2026 Shravani