debian-mirror-gitlab/core-js/internals/array-method-has-species-support.js

20 lines
666 B
JavaScript
Raw Normal View History

2019-09-25 13:30:05 +05:30
var fails = require('../internals/fails');
var wellKnownSymbol = require('../internals/well-known-symbol');
2019-10-31 01:37:42 +05:30
var V8_VERSION = require('../internals/v8-version');
2019-09-25 13:30:05 +05:30
var SPECIES = wellKnownSymbol('species');
module.exports = function (METHOD_NAME) {
2019-10-31 01:37:42 +05:30
// We can't use this feature detection in V8 since it causes
// deoptimization and serious performance degradation
// https://github.com/zloirock/core-js/issues/677
return V8_VERSION >= 51 || !fails(function () {
2019-09-25 13:30:05 +05:30
var array = [];
var constructor = array.constructor = {};
constructor[SPECIES] = function () {
return { foo: 1 };
};
return array[METHOD_NAME](Boolean).foo !== 1;
});
};