Welcome to mirror list, hosted at ThFree Co, Russian Federation.

defineProperty.js « helpers « test « es-abstract « node_modules - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8f925bea831e4deab03c3c99c1369f63208c3e27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'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;