Created
April 29, 2016 10:04
-
-
Save sandman21dan/0f99b20be3d6162a804ecea2828c0ada to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
'use strict'; | |
angular | |
.module('appName') | |
.filter('splitCamelCase', splitCamelCase); | |
function splitCamelCase() { | |
return splitCamelCaseFilter; | |
function splitCamelCaseFilter(input) { | |
return input | |
// insert a space before all caps | |
.replace(/([A-Z])/g, ' $1') | |
// uppercase the first character | |
.replace(/^./, function(str) { | |
return str.toUpperCase(); | |
}); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment