-
Notifications
You must be signed in to change notification settings - Fork 194
Expand file tree
/
Copy pathinflector.js
More file actions
28 lines (26 loc) · 722 Bytes
/
inflector.js
File metadata and controls
28 lines (26 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'use strict';
var Inflector = require('inflected');
module.exports = {
caserize: function (attribute, opts) {
attribute = Inflector.underscore(attribute);
switch (opts.keyForAttribute) {
case 'dash-case':
case 'lisp-case':
case 'spinal-case':
case 'kebab-case':
return Inflector.dasherize(attribute);
case 'underscore_case':
case 'snake_case':
return attribute;
case 'CamelCase':
return Inflector.camelize(attribute);
case 'camelCase':
return Inflector.camelize(attribute, false);
default:
return Inflector.dasherize(attribute);
}
},
pluralize: function (type) {
return Inflector.pluralize(type);
}
};