🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

active-inflector

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

active-inflector

active-inflector goal is to be rails compatible.

0.1.0
latest
Source
npm
Version published
Weekly downloads
2.7K
19.42%
Maintainers
1
Weekly downloads
 
Created
Source

Active Inflector CI size

Active Inflector is a library for inflecting words between plural and singular forms. Active Inflector aims to be compatible with ActiveSupport::Inflector from Ruby on Rails, including the ability to add your own inflections in your app.

Compatibility

Requirements:

  • ESM
  • Private Fields

As always, a consuming project can run a transpiler over dependencies.

Installation

pnpm add active-inflector

Usage

All methods are always available from the active-inflector module:

import { Inflector, singularize, pluralize } from "active-inflector";

Inflector.inflector.singularize("tacos"); // taco
Inflector.inflector.pluralize("taco"); // tacos

singularize("tacos"); // taco
pluralize("taco"); // tacos

pluralize(2, "taco"); // 2 tacos
pluralize(2, "tacos", { withoutCount: true }); // tacos

Custom Rules

If necessary you can setup special inflection rules for your application:

import { Inflector } from "active-inflector";

Inflector.inflector.irregular("person", "people");
Inflector.inflector.uncountable("sheep");

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Keywords

inflector

FAQs

Package last updated on 06 Mar 2024

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