Last active
December 18, 2015 12:39
-
-
Save mjuhl/5784155 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (exports) { | |
var Obj = { | |
support: { | |
// checks if Object.defineProperty exists and works as expected (not the case in IE8) | |
'define_prop' : (function () { | |
try { | |
return return '_' in Object.defineProperty({}, '_', {}); | |
} catch (e) { | |
return false; | |
} | |
})() | |
} | |
}; | |
// use Object.defineProperty if available, otherwise use a basic shim | |
var define_prop = Obj.support.define_prop | |
? Object.defineProperty | |
: function(obj, prop, desc) { | |
obj[prop] = desc.value; | |
} | |
; | |
exports.Obj = Obj; | |
})(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment