Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[minor] Use inflect for resourceful.common

  • Loading branch information...
commit 7195bcfdcc28fdbed397f75d81321523016b44be 1 parent 1b418f7
@pksunkara pksunkara authored
View
12 lib/resourceful/common.js
@@ -5,7 +5,9 @@
* MIT LICENCE
*
*/
-var util = require('util');
+var util = require('util'),
+ inflect = require('i')();
+
var common = exports;
common.mixin = function (target) {
@@ -71,10 +73,6 @@ common.typeOf = function (value) {
return derived;
};
-common.capitalize = function (str) {
- return str && str[0].toUpperCase() + str.slice(1);
-};
+common.capitalize = inflect.camelize;
-common.pluralize = function (s) {
- return /s$/.test(s) ? s : s + 's';
-};
+common.pluralize = inflect.pluralize;
View
1  package.json
@@ -21,6 +21,7 @@
},
"dependencies": {
"cradle": "0.6.x",
+ "i": "0.3.x",
"revalidator": "0.1.x"
},
"devDependencies": {
View
2  test/relationship-test.js
@@ -105,7 +105,7 @@ function categoryParentTest(name) {
return {
topic: function(){
// FIXME category pluralized should be categories (maybe use https://github.com/MSNexploder/inflect?)
- this.Category.categorys(parent_id, this.callback);
+ this.Category.categories(parent_id, this.callback);
},
'should return the children': function(err, children){
assert.isNull(err);
Please sign in to comment.
Something went wrong with that request. Please try again.