Sha256: b6c12ba2ff58b1a71b2813fe5b9ef89cb2645958d18991ec3247d89540438326

Contents?: true

Size: 806 Bytes

Versions: 3

Compression:

Stored size: 806 Bytes

Contents

if (Array.implement) {
  Array.implement({
    first: function(n){
      return (n || n === 0) ? this.slice(0, n) : this[0]
    },
    last: function(n){
      if (n >= this.length) return this
      return (n || n === 0) ? this.slice(this.length - n, this.length) : this[this.length - 1]
    },
    compact: function() {
      for (var i = 0, length = this.length; i < length; i++) {
        var el = this.shift()
        if (el != undefined && el != null && el != '') this.push(el)
      }
      return this
    },
    deleteIf: function(fn){
      for (var i = 0, length = this.length; i < length; i++) {
        var el = this.shift()
        if (!fn.call(el)) this.push(el)
      }
      return this
    }
  })
}
else {
  if (console && console.error) console.error('Mootools is not yet installed.')
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mootools-plus-0.1.1 vendor/assets/javascripts/mootools-plus/array.js
mootools-plus-0.1.0 vendor/assets/javascripts/mootools-plus/array.js
mootools-plus-0.0.3 vendor/assets/javascripts/mootools-plus/array.js