es.set.intersection.v2.js 680 B

12345678910111213141516
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var fails = require('../internals/fails');
  4. var intersection = require('../internals/set-intersection');
  5. var setMethodAcceptSetLike = require('../internals/set-method-accept-set-like');
  6. var INCORRECT = !setMethodAcceptSetLike('intersection') || fails(function () {
  7. // eslint-disable-next-line es/no-array-from, es/no-set -- testing
  8. return String(Array.from(new Set([1, 2, 3]).intersection(new Set([3, 2])))) !== '3,2';
  9. });
  10. // `Set.prototype.intersection` method
  11. // https://tc39.es/ecma262/#sec-set.prototype.intersection
  12. $({ target: 'Set', proto: true, real: true, forced: INCORRECT }, {
  13. intersection: intersection
  14. });