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.
 
 
 

23 lines
839 B

'use strict';
var $ = require('../internals/export');
var uncurryThis = require('../internals/function-uncurry-this');
var anObject = require('../internals/an-object');
var toString = require('../internals/to-string');
var getSetIterator = require('../internals/get-set-iterator');
var iterate = require('../internals/iterate');
var arrayJoin = uncurryThis([].join);
var push = [].push;
// `Set.prototype.join` method
// https://github.com/tc39/proposal-collection-methods
$({ target: 'Set', proto: true, real: true, forced: true }, {
join: function join(separator) {
var set = anObject(this);
var iterator = getSetIterator(set);
var sep = separator === undefined ? ',' : toString(separator);
var result = [];
iterate(iterator, push, { that: result, IS_ITERATOR: true });
return arrayJoin(result, sep);
}
});