equalsSet.js 489 B

123456789101112131415161718192021222324252627
  1. /**
  2. * Copyright (c) 2013-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. *
  8. * @typechecks
  9. */
  10. 'use strict';
  11. var everySet = require('./everySet');
  12. /**
  13. * Checks if two sets are equal
  14. */
  15. function equalsSet(one, two) {
  16. if (one.size !== two.size) {
  17. return false;
  18. }
  19. return everySet(one, function (value) {
  20. return two.has(value);
  21. });
  22. }
  23. module.exports = equalsSet;