Skip to content

Instantly share code, notes, and snippets.

@spsaucier

spsaucier/app.js Secret

Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spsaucier/028dd17a8248cbee6239 to your computer and use it in GitHub Desktop.
Save spsaucier/028dd17a8248cbee6239 to your computer and use it in GitHub Desktop.
FFA_SW 12
.filter('capitalize', function() {
// Send the results of this manipulating function back to the view.
return function (input) {
// If input exists, replace the first letter of each word with its capital equivalent.
return (!!input) ? input.replace(/([^\W_]+[^\s-]*) */g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1)}) : '';
}
})
.filter('lastdir', function () {
// Send the results of this manipulating function back to the view.
return function (input) {
// Simple JS to split & slice like a fine chef.
return (!!input) ? input.split('/').slice(-2, -1)[0] : '';
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment