lib/assets/javascripts/extensions.coffee in material_raingular-0.0.4.2.1 vs lib/assets/javascripts/extensions.coffee in material_raingular-0.0.4.3
- old
+ new
@@ -1,5 +1,11 @@
+String.prototype.to_number = ->
+ Number(this)
+String.prototype.to_string = ->
+ this.toString()
+String.prototype.to_date = ->
+ new Date(this)
Array.prototype.empty = ->
this.length == 0
Array.prototype.present = ->
this.length != 0
Array.prototype.min = ->
@@ -37,9 +43,10 @@
total += parseFloat(i) if i
total
Array.prototype.includes = (entry)->
this.indexOf(entry) > -1
Array.prototype.drop = (entry)->
+ return this unless this.indexOf(entry) > -1
this.splice(this.indexOf(entry),1)
String.prototype.titleize = ->
return this.replace(/\_/g,' ').replace(/([A-Z])/g, ' $1').trim().replace(/\b[a-z]/g, (letter)->
return letter[0].toUpperCase())
Array.prototype.pluck = (property) ->