Skip to content

Instantly share code, notes, and snippets.

@mjuhl
Last active December 18, 2015 12:39
Show Gist options
  • Save mjuhl/5784155 to your computer and use it in GitHub Desktop.
Save mjuhl/5784155 to your computer and use it in GitHub Desktop.
(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