1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-09-20 14:01:55 +00:00
musix-oss/node_modules/es-abstract/test/helpers/defineProperty.js

23 lines
476 B
JavaScript
Raw Normal View History

2020-03-03 20:30:50 +00:00
'use strict';
var oDP = Object.defineProperty;
try {
oDP({}, 'a', { value: 1 });
} catch (e) {
// IE 8
oDP = null;
}
module.exports = function defineProperty(O, P, Desc) {
if (oDP) {
return oDP(O, P, Desc);
}
if ((Desc.enumerable && Desc.configurable && Desc.writable) || !(P in O)) {
O[P] = Desc.value; // eslint-disable-line no-param-reassign
return O;
}
throw new SyntaxError('helper does not yet support this configuration');
};
module.exports.oDP = oDP;