Sha256: 0bfb6e3baedb26ad5471b7b763bc7adffdef9f9c1046e3455247f55228c7b0bc

Contents?: true

Size: 558 Bytes

Versions: 2

Compression:

Stored size: 558 Bytes

Contents

# Hack in support for constructor.name for IE >= 9
# http://matt.scharley.me/2012/03/09/monkey-patch-name-ie.html
# http://stackoverflow.com/questions/332422/how-do-i-get-the-name-of-an-objects-type-in-javascript
if Function.prototype.name == undefined and Object.defineProperty != undefined
  Object.defineProperty( Function.prototype,'name',
    get: () ->
      funcNameRegex = /function\s([^(]{1,})\(/
      results = (funcNameRegex).exec(@toString())
      return if results and results.length > 1 then results[1].trim() else ""
    set: (value) -> {} )

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cartilage-0.1.2 app/assets/javascripts/extensions/constructor_name.js.coffee
cartilage-0.1.1 app/assets/javascripts/extensions/constructor_name.js.coffee