Giter Club home page Giter Club logo

ember-inflector's Introduction

Ember Inflector Build Status

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

Installation

Ember CLI/NPM:

npm install --save ember-inflector

Usage

All methods are always available from Ember.Inflector, but in Ember CLI, you can always import instead:

import Inflector from 'ember-inflector';
import {singularize, pluralize} from 'ember-inflector';

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

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

// or if not using Ember CLI/ES6
Ember.Inflector.inflector.pluralize("taco"); // tacos

Template Helpers

pluralize

Pluralize a word

{{pluralize "taco"}} //tacos

Specify a count with the word, with the pluralization being based on the number of items.

{{pluralize 1 "taco"}} //1 taco
{{pluralize 2 "taco"}} //2 tacos

Specify a count with the word, with the pluralization being based on the number of items. Specify without-count=true to return on the word without the number.

{{pluralize 1 "taco" without-count=true}} //taco
{{pluralize 2 "taco" without-count=true}} //tacos

singularize

{{singularize 'octopi'}} //octopus

ember-inflector's People

Contributors

stefanpenner avatar fsmanuel avatar olivia avatar fivetanley avatar victornamuso avatar karlguillotte avatar rwjblue avatar cibernox avatar ember-tomster avatar tricknotes avatar mmun avatar glaukommatos avatar heroiceric avatar bradleypriest avatar blimmer avatar ghempton avatar igort avatar jerel avatar jcope2013 avatar kratiahuja avatar krisselden avatar nathanhammond avatar vine77 avatar oinutter avatar olleolleolle avatar locks avatar sandstrom avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.