Sha256: df8afaed97fc5b5299e805f720453bc546cd366ff97a89ccdab4c2109fc3b331

Contents?: true

Size: 761 Bytes

Versions: 19

Compression:

Stored size: 761 Bytes

Contents

String.prototype.toCamel = ->
  str = @replace /((\-|_)[a-z])/g, ($1) -> $1[1].toUpperCase()
  str[0].toLowerCase() + str.slice(1)

String.prototype.toCapitalCamel = ->
  str = @toCamel()
  str[0].toUpperCase() + str.slice(1)

String.prototype.toDash = ->
  str = @replace /(_[a-z]|[A-Z])/g, ($1) -> "-" + $1.replace('_', '')
  str = str.slice(1) if str[0] is "-"
  str.toLowerCase()

String.prototype.toUnderscore = ->
  str = @replace /(\-[a-z]|[A-Z])/g, ($1) -> "_" + $1.replace('-', '')
  str = str.slice(1) if str[0] is "_"
  str.toLowerCase()

String.prototype.toLabel = ->
  str = @replace /(\-[a-z]|_[a-z]|[A-Z])/g, ($1) ->
    " " + if $1[1] then $1[1]?.toUpperCase() else $1
  str = str.slice(1) if str[0] is " "
  str[0].toUpperCase() + str.slice(1)

Version data entries

19 entries across 19 versions & 1 rubygems

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