UNPKG

array-includes

Version:

An ES7/ES2016 spec-compliant `Array.prototype.includes` shim/polyfill/replacement that works as far down as ES3.

20 lines (14 loc) • 432 B
'use strict'; var define = require('define-properties'); var shimUnscopables = require('es-shim-unscopables'); var getPolyfill = require('./polyfill'); module.exports = function shimArrayPrototypeIncludes() { var polyfill = getPolyfill(); define( Array.prototype, { includes: polyfill }, { includes: function () { return Array.prototype.includes !== polyfill; } } ); shimUnscopables('includes'); return polyfill; };