MCPcopy Index your code
hub / github.com/formatjs/formatjs / formatToParts

Method formatToParts

packages/intl-listformat/index.ts:288–303  ·  view source on GitHub ↗
(elements: Iterable<string>)

Source from the content-addressed store, hash-verified

286 return result
287 }
288 formatToParts(elements: Iterable<string>): Part[] {
289 validateInstance(this, 'format')
290 const parts = createPartsFromList(
291 ListFormat.__INTERNAL_SLOT_MAP__,
292 this,
293 stringListFromIterable(elements)
294 )
295 if (!Array.isArray(parts)) {
296 return [parts as Part]
297 }
298 const result: Part[] = []
299 for (const part of parts) {
300 result.push({...part} as Part)
301 }
302 return result
303 }
304
305 resolvedOptions(): ResolvedIntlListFormatOptions {
306 validateInstance(this, 'resolvedOptions')

Callers

nothing calls this directly

Calls 3

createPartsFromListFunction · 0.85
stringListFromIterableFunction · 0.85
validateInstanceFunction · 0.70

Tested by

no test coverage detected