Skip to content

Commit dc3afbd

Browse files
committed
refac: add titleize as an alias #239
Thanks to @Anber, I found a duplicate filter that I merged by myself. This commit remove the duplicate code, and set titleize to be an alias of ucfirst
1 parent 60423d7 commit dc3afbd

File tree

3 files changed

+17
-51
lines changed

3 files changed

+17
-51
lines changed

src/_filter/string/titleize.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/_filter/string/ucfirst.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,20 @@
77
* ucfirst
88
*/
99
angular.module('a8m.ucfirst', [])
10-
.filter('ucfirst', [function() {
11-
return function(input) {
12-
return isString(input)
13-
? input
14-
.split(' ')
15-
.map(function (ch) {
16-
return ch.charAt(0).toUpperCase() + ch.substring(1);
17-
})
18-
.join(' ')
19-
: input;
20-
}
21-
}]);
10+
.filter({
11+
ucfirst: ucfirstFilter,
12+
titleize: ucfirstFilter
13+
});
14+
15+
function ucfirstFilter() {
16+
return function (input) {
17+
return isString(input)
18+
? input
19+
.split(' ')
20+
.map(function (ch) {
21+
return ch.charAt(0).toUpperCase() + ch.substring(1);
22+
})
23+
.join(' ')
24+
: input;
25+
}
26+
}

test/spec/filter/string/titleize.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)