equalsSet.js.flow 556 B

12345678910111213141516171819202122232425262728
  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. * @providesModule equalsSet
  8. * @flow
  9. * @typechecks
  10. */
  11. 'use strict';
  12. import type Set from './Set';
  13. var everySet = require('./everySet');
  14. /**
  15. * Checks if two sets are equal
  16. */
  17. function equalsSet<T>(one: Set<T>, two: Set<T>): boolean {
  18. if (one.size !== two.size) {
  19. return false;
  20. }
  21. return everySet(one, value => two.has(value));
  22. }
  23. module.exports = equalsSet;