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

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/es-abstract/test/helpers/defineProperty.js')
-rw-r--r--node_modules/es-abstract/test/helpers/defineProperty.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/node_modules/es-abstract/test/helpers/defineProperty.js b/node_modules/es-abstract/test/helpers/defineProperty.js
new file mode 100644
index 000000000..8f925bea8
--- /dev/null
+++ b/node_modules/es-abstract/test/helpers/defineProperty.js
@@ -0,0 +1,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;