From 7eda24ce526568ab53c609d75ba5e7373561a0c4 Mon Sep 17 00:00:00 2001 From: zwug Date: Wed, 4 Oct 2017 18:41:29 +0300 Subject: [PATCH 1/3] changed property descriptor for Array.includes polyfill --- lib/polyfills.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/polyfills.js b/lib/polyfills.js index 887c5b3f3f..efae070a59 100644 --- a/lib/polyfills.js +++ b/lib/polyfills.js @@ -5,5 +5,11 @@ // internal-ip@2.x uses [].includes if (!Array.prototype.includes) { - Array.prototype.includes = require('array-includes'); + const includes = require('array-includes'); + Object.defineProperty(Array.prototype, 'includes', { + enumerable: false, + configurable: false, + writable: false, + value: includes.getPolyfill() + }); } From 54d56f21dc8ef3af684927fd2d588c14bffb3da6 Mon Sep 17 00:00:00 2001 From: zwug Date: Wed, 4 Oct 2017 20:38:32 +0300 Subject: [PATCH 2/3] replaced defineProperty with shim --- lib/polyfills.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/polyfills.js b/lib/polyfills.js index efae070a59..fb214ef5ae 100644 --- a/lib/polyfills.js +++ b/lib/polyfills.js @@ -6,10 +6,5 @@ // internal-ip@2.x uses [].includes if (!Array.prototype.includes) { const includes = require('array-includes'); - Object.defineProperty(Array.prototype, 'includes', { - enumerable: false, - configurable: false, - writable: false, - value: includes.getPolyfill() - }); + includes.shim(); } From a67d5273a2ecbc4b50e2058a11f773a7c9ab3c92 Mon Sep 17 00:00:00 2001 From: zwug Date: Wed, 4 Oct 2017 21:04:20 +0300 Subject: [PATCH 3/3] removed Array.includes existance checking --- lib/polyfills.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/polyfills.js b/lib/polyfills.js index fb214ef5ae..ba30c71535 100644 --- a/lib/polyfills.js +++ b/lib/polyfills.js @@ -1,10 +1,8 @@ 'use strict'; /* polyfills for Node 4.8.x users */ -/* eslint no-extend-native: off, global-require: off */ // internal-ip@2.x uses [].includes -if (!Array.prototype.includes) { - const includes = require('array-includes'); - includes.shim(); -} +const includes = require('array-includes'); + +includes.shim();