options.js (1105B)
1 // Copyright (C) 2025 André Bargull. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 esid: sec-iterator.zipkeyed 6 description: > 7 The "options" argument can either be undefined or an object. 8 info: | 9 Iterator.zipKeyed ( iterables [ , options ] ) 10 ... 11 2. Set options to ? GetOptionsObject(options). 12 ... 13 14 GetOptionsObject ( options ) 15 1. If options is undefined, then 16 a. Return OrdinaryObjectCreate(null). 17 2. If options is an Object, then 18 a. Return options. 19 3. Throw a TypeError exception. 20 features: [joint-iteration] 21 ---*/ 22 23 var validOptions = [ 24 undefined, 25 {}, 26 ]; 27 28 var invalidOptions = [ 29 null, 30 true, 31 "", 32 Symbol(), 33 0, 34 0n, 35 ]; 36 37 // The "options" argument can also be absent. 38 Iterator.zipKeyed({}); 39 40 // All valid option values are accepted. 41 for (var options of validOptions) { 42 Iterator.zipKeyed({}, options); 43 } 44 45 // Throws a TypeError for invalid option values. 46 for (var options of invalidOptions) { 47 assert.throws(TypeError, function() { 48 Iterator.zipKeyed({}, options); 49 }); 50 } 51 52 reportCompare(0, 0);