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

fox-inflector

v2.0.5

Published

library that can perform string manipulations

Downloads

47

Readme

Inflector

The library supplies functions to perform string manipulations with regard to uppercase/lowercase and singular/plural forms of words.

Find it in github

Installation

npm install fox-inflector

Usage

pluralize

Returns the plural of the word

pluralize('ox');       // oxen

same function might be used as: (This is applicable for all functions)

'apple'.pluralize();   // apples

pluralized

Returns the plural of the word if second argument is greater then 1

pluralized('ox', 0);       // ox
pluralized('ox', 1);       // ox
pluralized('ox', 2);       // oxen

same function might be used as: (This is applicable for all functions)

'apple'.pluralize();   // apples

singularize

Returns the singular of the word

singularize('oxen');    // ox
singularize('apples');  // apple

titleize

Converts an underscored or CamelCase word into a English sentence.

titleize('TestWord');   // Test word

camelize

Returns given word as CamelCased Converts a word like "send_email" to "SendEmail". It will remove non alphanumeric character from the word, so "test#&case" will be converted to "TestCase"

camelize('test_word');  // TestWord

camel2words

Converts a CamelCase name into space-separated words. For example, 'PostTag' will be converted to 'Post Tag'.

camel2words('TestWord'); // Test Word
camel2words('testWord_Hello', false); // test word hello

camel2id

Converts a CamelCase name into an ID in lowercase. Words in the ID may be concatenated using the specified character (defaults to '-'). For example, 'PostTag' will be converted to 'post-tag'.

camel2id('TestWord');   // test-word
camel2id('testWord_Hello', '/');   // test/word/hello

id2camel

Converts an ID into a CamelCase name. Words in the ID separated by separator (defaults to '-') will be concatenated into a CamelCase name. For example, 'post-tag' is converted to 'PostTag'.

id2camel('test-word');  // TestWord
id2camel('test-word-hello123-hi', '-');  // TestWordHello123Hi

underscore

Converts any "CamelCased" into an "underscored_word".

underscore('TestWord'); // test_word
underscore('TestWord-Hello123Hi'); // test_word-hello123_hi

humanize

Returns a human-readable string from word

humanize('test_word_id');   // Test word

variablize

Converts a word like "send_email" to "sendEmail" (Same as camelize but first char is in lowercase)

variablize('test_word_id');   // testWordId

tableize

Converts a class name to its table name (pluralized)

tableize('InfoPerson');   // info_people

slug

Returns a string with all spaces converted to given replacement and non word characters removed. Maps special characters to ASCII

slug('test word # *@#id');   // test-word-id
slug('яблоко от яблони нe δàŁĒķỒ');   // yabloko-ot-yabloni-ne-daleko

classify

Converts a table name to its class name. For example, converts "people" to "Person"

classify('test_words');   // TestWord
classify('language_japanese');   // LanguageJapanese

ordinalize

Converts number to its ordinal English form. For example, converts 13 to 13th, 2 to 2nd ...

ordinalize(1);   // 1st
ordinalize(2);   // 1nd
ordinalize(3);   // 1rd
ordinalize(13);  // 13th