Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for singularizing categories and series #8

Merged
merged 2 commits into from

2 participants

@dbrain

Hi,

I've put in a fix to the regex (ordering and some rules) for singularizing categories to category and series to series. Couldn't get the tests running (expresso was whinging) but made my own little assert.equals functions and ran tests through there successfully.

Thanks!

@tj tj merged commit 20b61aa into tj:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 6, 2011
  1. Fix movies/series after categories change

    Danny Brain authored
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 1 deletion.
  1. +3 −1 lib/languages/en.js
  2. +3 −0  test/inflection.en.test.js
View
4 lib/languages/en.js
@@ -53,8 +53,10 @@ en.singular(/s$/i, "")
.singular(/(^analy)ses$/i, "$1sis")
.singular(/([^f])ves$/i, "$1fe")
.singular(/([lr])ves$/i, "$1f")
- .singular(/([^aeiouy]|qu)ies$/i, "$1y")
.singular(/ies$/i, "ie")
+ .singular(/([^aeiouy]|qu)ies$/i, "$1y")
+ .singular(/(series)$/i, "$1")
+ .singular(/(mov)ies$/i, "$1ie")
.singular(/(x|ch|ss|sh)es$/i, "$1")
.singular(/([m|l])ice$/i, "$1ouse")
.singular(/(bus)es$/i, "$1")
View
3  test/inflection.en.test.js
@@ -70,6 +70,7 @@ module.exports = {
assert.equal('oxen', en.pluralize('ox'));
assert.equal('indices', en.pluralize('index'));
assert.equal('indices', en.pluralize('indice'));
+ assert.equal('categories', en.pluralize('category'));
},
'test .singularize()': function(assert){
@@ -94,6 +95,8 @@ module.exports = {
assert.equal('movie', en.singularize('movies'));
assert.equal('series', en.singularize('series'));
assert.equal('index', en.singularize('indices'));
+ assert.equal('category', en.singularize('categories'));
+ assert.equal('series', en.singularize('series'));
},
'test .isPlural()': function(assert){
Something went wrong with that request. Please try again.