Fixes casing
This commit is contained in:
15
Gulpfile.js
15
Gulpfile.js
@@ -2,21 +2,8 @@ var gulp = require('gulp');
|
||||
var iconfont = require('gulp-iconfont');
|
||||
var iconfontCss = require('gulp-iconfont-css');
|
||||
|
||||
String.prototype.toTitleCase = function() {
|
||||
return this.replace(/\w\S*/g, function(txt){ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); });
|
||||
};
|
||||
|
||||
String.prototype.toCamelCase = function() {
|
||||
var str = this.split('--');
|
||||
var result;
|
||||
|
||||
if (str && str.length > 1) {
|
||||
result = str[0] + str[1].toTitleCase();
|
||||
} else {
|
||||
result = this;
|
||||
}
|
||||
|
||||
return result.replace(/^([A-Z])|\s(\w)/g, function(match, p1, p2, offset) {
|
||||
return this.replace(/^([A-Z])|\s(\w)/g, function(match, p1, p2, offset) {
|
||||
if (p2) return p2.toUpperCase();
|
||||
return p1.toLowerCase();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user