Socket
Book a DemoInstallSign in
Socket

inflector-js

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inflector-js

A lightweight JavaScript utility for smart word transformations – from singular to plural, snake_case to camelCase, and everything in between.

latest
Source
npmnpm
Version
2.0.1
Version published
Maintainers
1
Created
Source

INFLECTOR-JS

A lightweight JavaScript utility for smart word transformations – from singular to plural, snake_case to camelCase, and everything in between.

Installation

Install via NPM

npm install inflector-js

Manual Download

Last Release

How to use

Node JS

Common JS

var Inflector = require('inflector-js');

ESM

import Inflector from 'inflector-js';
console.log(Inflector.camelize('message_properties'));

import { humanize } from 'inflector-js';
console.log(humanize('message_properties'));

Browser

<script
  type="text/javascript"
  src="assets/inflector-js/dist/index.global.js"
></script>

console.log(Inflector.camelize('message_properties'));

API

  • pluralize

Inflector.pluralize('person')           -> 'people'
Inflector.pluralize('octopus')          -> 'octopi'
Inflector.pluralize('Hat')              -> 'Hats'
Inflector.pluralize('person', 'guys')   -> 'guys'

  • singularize
Inflector.singularize('person')         -> 'person'
Inflector.singularize('octopi')         -> 'octopus'
Inflector.singularize('hats')           -> 'hat'
Inflector.singularize('guys', 'person') -> 'person'
  • camelize
Inflector.camelize('message_properties')        -> 'MessageProperties'
Inflector.camelize('message_properties', true)  -> 'messageProperties'
  • underscore
Inflector.underscore('MessageProperties')       -> 'message_properties'
Inflector.underscore('messageProperties')       -> 'message_properties'
  • humanize
Inflector.humanize('message_properties')        -> 'Message properties'
Inflector.humanize('message_properties')        -> 'message properties'
  • capitalize
Inflector.capitalize('message_properties')      -> 'Message_properties'
Inflector.capitalize('message properties')      -> 'Message properties'
  • dasherize
Inflector.dasherize('message_properties')       -> 'message-properties'
Inflector.dasherize('message properties')       -> 'message-properties'
  • camel2words
Inflector.camel2words('message_properties')         -> 'Message Properties'
Inflector.camel2words('message properties')         -> 'Message Properties'
Inflector.camel2words('Message_propertyId', true)   -> 'Message Properties Id'
  • demodulize
Inflector.demodulize('Message::Bus::Properties')    -> 'Properties'
  • tableize
Inflector.tableize('MessageBusProperty')    -> 'message_bus_properties'
  • classify
Inflector.classify('message_bus_properties')    -> 'MessageBusProperty'
  • foreignKey
Inflector.foreignKey('MessageBusProperty')       -> 'message_bus_property_id'
Inflector.foreignKey('MessageBusProperty', true) -> 'message_bus_propertyid'
  • ordinalize
Inflector.ordinalize('the 1 pitch')     -> 'the 1st pitch'

Author

Created and maintained by Dida Nurwanda
didanurwanda@gmail.com

License

This project is licensed under the MIT. See the LICENSE file for more details.

Keywords

javascript

FAQs

Package last updated on 28 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.