diff --git a/lib/generate-browserconfig-from-configuration.js b/lib/generate-browserconfig-from-configuration.js index 06fa2437..4e2d4cbd 100644 --- a/lib/generate-browserconfig-from-configuration.js +++ b/lib/generate-browserconfig-from-configuration.js @@ -4,7 +4,6 @@ module.exports = generateBrowserconfigFromConfiguration; const xmlbuilder = require('xmlbuilder'); const hasTarget = require('./has-target'); -const includes = require('./utils/includes'); const ALLOWED_ICON_ELEMENTS = [ 'square70x70logo', @@ -40,7 +39,7 @@ function constructTile(icons, color) { const tile = {}; icons.forEach(function(icon) { - if (!includes(ALLOWED_ICON_ELEMENTS, icon.element)) { + if (!ALLOWED_ICON_ELEMENTS.includes(icon.element)) { throw new Error(`The 'element' property of the icon for browserconfig.xml must be one of ${ALLOWED_ICON_ELEMENTS.join(', ')}`); } diff --git a/lib/utils/includes.js b/lib/utils/includes.js deleted file mode 100644 index 2184b499..00000000 --- a/lib/utils/includes.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -module.exports = includes; - -// Polyfill for Array.prototype.includes for Node.js < 6 -function includes(array, element) { - if (!array) { - return false; - } - - const length = array.length; - - for (let i = 0; i < length; i++) { - if (array[i] === element) { - return true; - } - } - - return false; -} diff --git a/node-tests/unit/utils/includes-test.js b/node-tests/unit/utils/includes-test.js deleted file mode 100644 index b41f23be..00000000 --- a/node-tests/unit/utils/includes-test.js +++ /dev/null @@ -1,18 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const includes = require('../../../lib/utils/includes'); - -describe('Unit: includes()', function() { - it('returns false if the array is null', function() { - assert.ok(!includes(null, 1)); - }); - - it('returns true if the array contains the element', function() { - assert.ok(includes([1, 2], 1)); - }); - - it('returns false if the array does not contain the element', function() { - assert.ok(!includes([1, 2], 3)); - }); -});