_createSet.js 501 B

1234567891011121314151617181920
  1. var Set = require('./_Set'),
  2. noop = require('./noop'),
  3. setToArray = require('./_setToArray');
  4. /** Used as references for various `Number` constants. */
  5. var INFINITY = 1 / 0;
  6. /**
  7. * Creates a set object of `values`.
  8. *
  9. * @private
  10. * @param {Array} values The values to add to the set.
  11. * @returns {Object} Returns the new set.
  12. */
  13. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  14. return new Set(values);
  15. };
  16. module.exports = createSet;