array-method-has-species-support.js 673 B

12345678910111213141516171819
  1. var fails = require('../internals/fails');
  2. var wellKnownSymbol = require('../internals/well-known-symbol');
  3. var V8_VERSION = require('../internals/engine-v8-version');
  4. var SPECIES = wellKnownSymbol('species');
  5. module.exports = function (METHOD_NAME) {
  6. // We can't use this feature detection in V8 since it causes
  7. // deoptimization and serious performance degradation
  8. // https://github.com/zloirock/core-js/issues/677
  9. return V8_VERSION >= 51 || !fails(function () {
  10. var array = [];
  11. var constructor = array.constructor = {};
  12. constructor[SPECIES] = function () {
  13. return { foo: 1 };
  14. };
  15. return array[METHOD_NAME](Boolean).foo !== 1;
  16. });
  17. };