Sha256: 940cde6cc47630b76d28345852b49fe790bf64d501b14f752c881d5dbed65e81

Contents?: true

Size: 1006 Bytes

Versions: 3

Compression:

Stored size: 1006 Bytes

Contents

#
# In desperation, I write this series of patches to make javascript more like ruby.
# I know, it's my fault not to appreciate javascript as it is.
# But, let's make the world how I would like it to be ...
#
# We could also have a look at:
#
#   * https://github.com/sagivo/Ruby-Javascript/blob/master/rjs.js
#   * https://github.com/rubyjs/core-lib
#
# SF 2013-03-08
#

# Array
# ==========================================================================================

Array.prototype.removeItem = (itemToRemoveFromArray)->
  this.splice( this.indexOf( itemToRemoveFromArray ), 1 )

Array.prototype.delete = (itemToRemoveFromArray)->
  this.removeItem( itemToRemoveFromArray )

Array.prototype.includes = (itemToCheckIfItIsIncluded)->
  return ( $.inArray( itemToCheckIfItIsIncluded, this ) != -1 )

Array.prototype.clear = ->
  this.length = 0

Array.prototype.pushArray = (arrayOfItemsToAppend)->
  this.push.apply( this, arrayOfItemsToAppend )
  # see: http://stackoverflow.com/questions/4156101/

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
your_platform-1.0.1 app/assets/javascripts/make-js-more-like-ruby.js.coffee
your_platform-1.0.0 app/assets/javascripts/make-js-more-like-ruby.js.coffee
your_platform-0.0.2 app/assets/javascripts/make-js-more-like-ruby.js.coffee