JSPM

js-inflector

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q12138F
  • License MIT

Basic naming utility for programmatically resolving plural, singular, capital, camel cased, and other word states.

Package Exports

  • js-inflector

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (js-inflector) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

js-inflector

Word magic.

Quick Start

```node var inflector = require('js-inflector'); ```
var inflect = inflector.start();

Examples

```node var someValue = 'tree'; ``` Modify word state: ```node var plural = inflect(someValue, 'plural'); //--> trees ```
var capital = inflect(someValue, 'capital');  
//--> Tree

Modify multiple word states at once:

var pluralAndCapital = inflect(someValue, ['capital', 'plural']);  
//--> Trees

Set a group state:

inflector.group({
  'properPlural': ['capital', 'plural']
});

With a group state:

var pluralAndCapital = inflect(someValue, 'properPlural');  
//--> Trees

Word States

- camelcase (camelcase | camel) - capitalize (cap | caps) - decapitalize (decapitalize | decap) - lowercase (lowercase | lower) - pluralize (plural | many) - singularize (singular | single) - uppercase (uppercase | upper)