/** * 23.2.1.1 * * Takes an optional `iterable` (which is basically any object that * implements a Symbol.iterator (@@iterator) method). That is a collection * of values used to instantiate the set. * * @param {*} iterable */ constructor(iterable) { if (this == null || (typeof this !== 'object' && typeof this !== 'function')) { throw new TypeError('Wrong set object type.'); } initSet(this); if (iterable != null) { var it = toIterator(iterable); var next; while (!(next = it.next()).done) { this.add(next.value); } } }
/** * 23.1.1.1 * Takes an `iterable` which is basically any object that implements a * Symbol.iterator (@@iterator) method. The iterable is expected to be a * collection of pairs. Each pair is a key/value pair that will be used * to instantiate the map. * * @param {*} iterable */ constructor(iterable) { if (!isObject(this)) { throw new TypeError('Wrong map object type.'); } initMap(this); if (iterable != null) { var it = toIterator(iterable); var next; while (!(next = it.next()).done) { if (!isObject(next.value)) { throw new TypeError('Expected iterable items to be pair objects.'); } this.set(next.value[0], next.value[1]); } } }
function Map(iterable){babelHelpers.classCallCheck(this,Map); if(!isObject(this)){ throw new TypeError('Wrong map object type.'); } initMap(this); if(iterable!=null){ var it=toIterator(iterable); var next; while(!(next=it.next()).done){ if(!isObject(next.value)){ throw new TypeError('Expected iterable items to be pair objects.'); } this.set(next.value[0],next.value[1]); } } }babelHelpers.createClass(Map,[{key:'clear',value:function clear()