MCPcopy
hub / github.com/prisma/prisma / writeJoined

Method writeJoined

packages/ts-builders/src/Writer.ts:46–59  ·  view source on GitHub ↗

* Adds several `values` to the current line, separated by `separator`. Both values and separator * can also be `Builder` instances for more advanced formatting. * * @param separator * @param values * @param writeItem allow to customize how individual item is written * @returns

(
    separator: string | BasicBuilder<ContextType>,
    values: T[],
    writeItem: (item: T, writer: this) => void = (item, w) => w.write(item),
  )

Source from the content-addressed store, hash-verified

44 * @returns
45 */
46 writeJoined<T extends string | BasicBuilder<ContextType>>(
47 separator: string | BasicBuilder<ContextType>,
48 values: T[],
49 writeItem: (item: T, writer: this) => void = (item, w) => w.write(item),
50 ): this {
51 const last = values.length - 1
52 for (let i = 0; i < values.length; i++) {
53 writeItem(values[i], this)
54 if (i !== last) {
55 this.write(separator)
56 }
57 }
58 return this
59 }
60
61 /**
62 * Adds a string to current line, flushes current line and starts a new line.

Callers 15

writeWithContentsMethod · 0.80
writeWithItemsMethod · 0.80
writeMethod · 0.80
writeMethod · 0.80
writeMethod · 0.80
writeMethod · 0.80
Writer.test.tsFile · 0.80
writeInlineMethod · 0.80
writeMethod · 0.80
writeMethod · 0.80
writeMethod · 0.80
writeMethod · 0.80

Calls 2

writeMethod · 0.95
writeMethod · 0.65

Tested by

no test coverage detected