nawafnaim / dart-inflection

A port of the Rails/ActiveSupport inflector library to Dart.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inflection

Build Status

In grammar, inflection or inflexion is the modification of a word to express different grammatical categories such as tense, mood, voice, aspect, person, number, gender and case.

A port of the Rails/ActiveSupport inflector library to Dart.

Usage

A simple usage example:

import 'package:inflection/inflection.dart';

main() {
  // Using 'shortcut' functions.
  
  print(pluralize("house")); // => "houses"
  print(singularize("axes")); // => "axis"
  print(convertToSnakeCase("CamelCaseName")); // => "camel_case_name"
  print(convertToSpinalCase("CamelCaseName")); // => "camel-case-name"
  print(past("forgo")); // => "forwent"

  // Using default encoders.
  
  print(PLURAL.convert("virus")); // => "viri"
  print(SINGULAR.convert("Matrices")); // => "Matrix"
  print(SINGULAR.convert("species")); // => "species"
  print(SNAKE_CASE.convert("CamelCaseName")); // => "camel_case_name"
  print(SPINAL_CASE.convert("CamelCaseName")); // => "camel-case-name"
  print(PAST.convert("miss")); // => "missed"
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

About

A port of the Rails/ActiveSupport inflector library to Dart.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Dart 99.4%Language:Shell 0.6%