* https://tc39.es/proposal-intl-list-format/#sec-createstringlistfromiterable * @param iterable list
(iterable: Iterable<unknown>)
| 108 | * @param iterable list |
| 109 | */ |
| 110 | function stringListFromIterable(iterable: Iterable<unknown>): string[] { |
| 111 | if (typeof iterable !== 'object') return [] |
| 112 | const elements: string[] = [] |
| 113 | const iterator = iterable[Symbol.iterator]() |
| 114 | let result: IteratorResult<unknown> |
| 115 | while (true) { |
| 116 | result = iterator.next() |
| 117 | if (result.done) break |
| 118 | if (typeof result.value !== 'string') { |
| 119 | const nextValue = result.value |
| 120 | throw new TypeError(`Iterable yielded ${nextValue} which is not a string`) |
| 121 | } |
| 122 | elements.push(result.value) |
| 123 | } |
| 124 | return elements |
| 125 | } |
| 126 | |
| 127 | function createPartsFromList( |
| 128 | internalSlotMap: WeakMap<ListFormat, ListFormatInternal>, |
no test coverage detected