Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

set-method-accept-set-like.js 750B

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict';
  2. var getBuiltIn = require('../internals/get-built-in');
  3. var createSetLike = function (size) {
  4. return {
  5. size: size,
  6. has: function () {
  7. return false;
  8. },
  9. keys: function () {
  10. return {
  11. next: function () {
  12. return { done: true };
  13. }
  14. };
  15. }
  16. };
  17. };
  18. module.exports = function (name) {
  19. var Set = getBuiltIn('Set');
  20. try {
  21. new Set()[name](createSetLike(0));
  22. try {
  23. // late spec change, early WebKit ~ Safari 17.0 beta implementation does not pass it
  24. // https://github.com/tc39/proposal-set-methods/pull/88
  25. new Set()[name](createSetLike(-1));
  26. return false;
  27. } catch (error2) {
  28. return true;
  29. }
  30. } catch (error) {
  31. return false;
  32. }
  33. };