summaryrefslogtreecommitdiffstats
path: root/js/vendor/angular-ui/modules/filters/inflector/inflector.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/vendor/angular-ui/modules/filters/inflector/inflector.js')
-rw-r--r--js/vendor/angular-ui/modules/filters/inflector/inflector.js44
1 files changed, 0 insertions, 44 deletions
diff --git a/js/vendor/angular-ui/modules/filters/inflector/inflector.js b/js/vendor/angular-ui/modules/filters/inflector/inflector.js
deleted file mode 100644
index 4ab74093a..000000000
--- a/js/vendor/angular-ui/modules/filters/inflector/inflector.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Converts variable-esque naming conventions to something presentational, capitalized words separated by space.
- * @param {String} value The value to be parsed and prettified.
- * @param {String} [inflector] The inflector to use. Default: humanize.
- * @return {String}
- * @example {{ 'Here Is my_phoneNumber' | inflector:'humanize' }} => Here Is My Phone Number
- * {{ 'Here Is my_phoneNumber' | inflector:'underscore' }} => here_is_my_phone_number
- * {{ 'Here Is my_phoneNumber' | inflector:'variable' }} => hereIsMyPhoneNumber
- */
-angular.module('ui.filters').filter('inflector', function () {
- function ucwords(text) {
- return text.replace(/^([a-z])|\s+([a-z])/g, function ($1) {
- return $1.toUpperCase();
- });
- }
-
- function breakup(text, separator) {
- return text.replace(/[A-Z]/g, function (match) {
- return separator + match;
- });
- }
-
- var inflectors = {
- humanize: function (value) {
- return ucwords(breakup(value, ' ').split('_').join(' '));
- },
- underscore: function (value) {
- return value.substr(0, 1).toLowerCase() + breakup(value.substr(1), '_').toLowerCase().split(' ').join('_');
- },
- variable: function (value) {
- value = value.substr(0, 1).toLowerCase() + ucwords(value.split('_').join(' ')).substr(1).split(' ').join('');
- return value;
- }
- };
-
- return function (text, inflector, separator) {
- if (inflector !== false && angular.isString(text)) {
- inflector = inflector || 'humanize';
- return inflectors[inflector](text);
- } else {
- return text;
- }
- };
-});