Sha256: 17a1449bb473c704d951acbcd98ef0418b91f8f37674452ae29706eb823df410

Contents?: true

Size: 1.2 KB

Versions: 19

Compression:

Stored size: 1.2 KB

Contents

(function() {
  String.prototype.toCamel = function() {
    var str;
    str = this.replace(/((\-|_)[a-z])/g, function($1) {
      return $1[1].toUpperCase();
    });
    return str[0].toLowerCase() + str.slice(1);
  };

  String.prototype.toCapitalCamel = function() {
    var str;
    str = this.toCamel();
    return str[0].toUpperCase() + str.slice(1);
  };

  String.prototype.toDash = function() {
    var str;
    str = this.replace(/(_[a-z]|[A-Z])/g, function($1) {
      return "-" + $1.replace('_', '');
    });
    if (str[0] === "-") {
      str = str.slice(1);
    }
    return str.toLowerCase();
  };

  String.prototype.toUnderscore = function() {
    var str;
    str = this.replace(/(\-[a-z]|[A-Z])/g, function($1) {
      return "_" + $1.replace('-', '');
    });
    if (str[0] === "_") {
      str = str.slice(1);
    }
    return str.toLowerCase();
  };

  String.prototype.toLabel = function() {
    var str;
    str = this.replace(/(\-[a-z]|_[a-z]|[A-Z])/g, function($1) {
      var ref;
      return " " + ($1[1] ? (ref = $1[1]) != null ? ref.toUpperCase() : void 0 : $1);
    });
    if (str[0] === " ") {
      str = str.slice(1);
    }
    return str[0].toUpperCase() + str.slice(1);
  };

}).call(this);

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
ela-4.1.6 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-4.1.5 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-4.1.4 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-4.1.3 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-4.1.2 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-4.1.1 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-4.1.0 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-4.0.0 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-3.4.3 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-3.4.2 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-3.4.0 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-3.3.1 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-3.3.0 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-3.2.0 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-3.1.1 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-3.1.0 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-3.0.0 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-2.0.0 dist/app_js/vendor/backbone.poised/string_mixin.js
ela-1.1.0 dist/app_js/vendor/backbone.poised/string_mixin.js