inflect

A port of the Rails / ActiveSupport inflector to JavaScript.

MIT 13 个版本
安装
npm install inflect
yarn add inflect
pnpm add inflect
bun add inflect
README

Inflect Build Status

A port of the Rails / ActiveSupport inflector to JavaScript (node.js and browser compatible).

Install

npm install inflect

Client version

Client version (minified)

Documentation

Documentation

Usage

inflect.pluralize('user'); // users

inflect.singularize('users'); // user

inflect.camelize('users_controller'); // UsersController

inflect.capitalize('user'); // User

inflect.decapitalize('User'); // user

inflect.titleize('man from the boondocks'); // Man From The Boondocks

inflect.underscore('UsersController'); // users_controller

inflect.dasherize('puni_puni'); // puni-puni

inflect.parameterize('Donald E. Knuth'); // donald-e-knuth

inflect.humanize('employee_salary'); // Employee salary

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Commit, do not mess with cakefile, package.json, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.
版本列表
0.5.0 2020-07-29
0.4.1 2020-04-07
0.4.0 2017-04-18
0.3.0 2012-09-20
0.2.2 2012-03-19
0.2.1 2012-03-19
0.2.0 2011-12-04
0.1.5 2011-11-20
0.1.4 2011-11-10
0.1.3 2011-08-11
0.1.2 2011-08-07
0.1.1 2011-07-31
0.1.0 2011-04-24