Sha256: 1c663d31ecf588709941f1f8cfdf98fa10c9b8181bd82742ae85495e4bd43c99

Contents?: true

Size: 760 Bytes

Versions: 8

Compression:

Stored size: 760 Bytes

Contents

Array::last = ->
  if @.length > 0
    @[@.length - 1]

Array::first = ->
  @[0]

Array::removeByIndex = (arrayIndex)->
  @.splice(arrayIndex, 1)

Array::valDetect = (v, prop = 'id') ->
  res = null
  for el in @
    if el[prop] is v
      res = el
  res

Array::includes = (obj) ->
  for el, i in @
    if el == obj
      return i
  return false

Array::remove = ->
  what = undefined
  a = arguments
  L = a.length
  ax = undefined
  while L and @length
    what = a[--L]
    until (ax = @indexOf(what)) is -1
      @splice ax, 1
      break;
  this

String::parseQuery = ->
  h = {}
  qs = $.trim(this).match(/([^?#]*)(#.*)?$/)[0]
  return {}  unless qs
  pairs = qs.split("&")
  $.each pairs, (i, v) ->
    pair = v.split("=")
    h[pair[0]] = pair[1]
  h

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ab_admin-0.8.2 app/assets/javascripts/ab_admin/core/deprecated_utils.js.coffee
ab_admin-0.8.1 app/assets/javascripts/ab_admin/core/deprecated_utils.js.coffee
ab_admin-0.8.0 app/assets/javascripts/ab_admin/core/deprecated_utils.js.coffee
ab_admin-0.7.0 app/assets/javascripts/ab_admin/core/deprecated_utils.js.coffee
ab_admin-0.6.1 app/assets/javascripts/ab_admin/core/deprecated_utils.js.coffee
ab_admin-0.6.0 app/assets/javascripts/ab_admin/core/deprecated_utils.js.coffee
ab_admin-0.5.0 app/assets/javascripts/ab_admin/core/deprecated_utils.js.coffee
ab_admin-0.4.0 app/assets/javascripts/ab_admin/core/deprecated_utils.js.coffee