• Stars
    star
    107
  • Rank 312,299 (Top 7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 11 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ember-inflector goal is to be rails compatible.

Ember Inflector CI

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.

Compatibility

  • Ember.js v3.16 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Installation

ember install ember-inflector

Usage

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

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

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 'ember-inflector';

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

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

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

More Repositories

1

ember.js

Ember.js - A JavaScript framework for creating ambitious web applications
JavaScript
22,427
star
2

data

A lightweight reactive data library for javascript applications. Designed over composable primitives.
JavaScript
3,036
star
3

ember-rails

Ember for Rails 3.1+
Ruby
1,363
star
4

ember-inspector

Adds an Ember tab to the browser's Developer Tools that allows you to inspect Ember objects in your application.
JavaScript
976
star
5

rfcs

RFCs for changes to Ember
793
star
6

website

Source for emberjs.com
HTML
642
star
7

list-view

An incremental rendering list view for Ember.js
JavaScript
465
star
8

starter-kit

A starter kit for Ember
JavaScript
373
star
9

guides

This repository is DEPRECATED!
CSS
283
star
10

ember-qunit

QUnit test helpers for Ember
JavaScript
260
star
11

ember-test-helpers

Test-framework-agnostic helpers for testing Ember.js applications
JavaScript
189
star
12

ember-cli-babel

Ember CLI plugin for Babel
JavaScript
153
star
13

core-notes

Meeting minutes from the Ember.js core teams
151
star
14

ember-mocha

Mocha helpers for testing Ember.js applications
JavaScript
130
star
15

group-helper

An experimental helper to change the granularity of bindings.
JavaScript
87
star
16

ember-render-modifiers

Implements did-insert / did-update / will-destroy modifiers for emberjs/rfcs#415
JavaScript
82
star
17

ember-states

JavaScript
52
star
18

ember-gem

Development tools for Ember.js
JavaScript
40
star
19

ember-optional-features

JavaScript
40
star
20

ember-dev

Development Tools for Ember Packages
JavaScript
40
star
21

emberjs.github.com

Ember.js Website - DO NOT OPEN ISSUES/PRs HERE!!! Please send them to https://github.com/emberjs/website instead.
HTML
34
star
22

ember-test-waiters

An Ember addon to allow @ember/test-helpers to manage asynchronous operations
TypeScript
27
star
23

quickstart-code-sample

Code samples from the quickstart guide
CSS
22
star
24

ember-legacy-views

Extended support for Ember.View and friends until Ember 2.4
JavaScript
18
star
25

ember-jquery

JavaScript
15
star
26

rfc-tracking

This project is no longer maintained
12
star
27

log-manager

Hierarchical Logging + multiple appenders -- Basis for Ember.js logging
JavaScript
12
star
28

ember-classic-decorator

JavaScript
12
star
29

emberjs-build

Build pipeline for Ember.js
JavaScript
12
star
30

ember-data-fixture-adapter

JavaScript
11
star
31

babel-plugin-ember-template-compilation

Babel implementation of Ember's low-level template-compilation API
TypeScript
9
star
32

ember-legacy-controllers

JavaScript
8
star
33

ember-octanify

JavaScript
8
star
34

ember-2-legacy

JavaScript
8
star
35

ember-module-unification-blueprint

Ember CLI blueprint for initializing a Ember application with a module unification layout.
JavaScript
7
star
36

ember-string

Ember addon with String-related utilities
JavaScript
6
star
37

ember-legacy-built-in-components

TypeScript
5
star
38

ember-debug

JavaScript
5
star
39

ember-copy

JavaScript
4
star
40

ember-edition-utils

JavaScript
4
star
41

whiteboard

For experimental design projects, efforts, proposals, etc.
4
star
42

guides.emberjs.com

A repo to contain versioned guides
HTML
3
star
43

ember-ordered-set

JavaScript
3
star
44

eslint-plugin-ember-internal

ESLint rules used internally by Ember.js
JavaScript
2
star
45

ember-mocha-builds

Dist repo for ember-mocha
JavaScript
1
star
46

tracking-polaris

Repo for tracking Polaris project
1
star
47

ember

The Ember.js npm module
JavaScript
1
star
48

testem-failure-only-reporter

A testem reporter that only outputs failures
JavaScript
1
star