WeakSet.js (628B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 // ES2017 draft rev 0e10c9f29fca1385980c08a7d5e7bb3eb775e2e4 6 // 23.4.1.1 WeakSet, steps 6-8 7 function WeakSetConstructorInit(iterable) { 8 var set = this; 9 10 // Step 6.a. 11 var adder = set.add; 12 13 // Step 6.b. 14 if (!IsCallable(adder)) { 15 ThrowTypeError(JSMSG_NOT_FUNCTION, typeof adder); 16 } 17 18 // Steps 6.c-8. 19 for (var nextValue of allowContentIter(iterable)) { 20 callContentFunction(adder, set, nextValue); 21 } 22 }