UNPKG

@sqb/builder

Version:

Extensible multi-dialect SQL query builder written with TypeScript

31 lines (30 loc) 711 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.printArray = printArray; /** * Prints array with line feeding */ function printArray(arr, sep, lfLen) { let out = ''; let line = ''; let k = 0; lfLen = lfLen || 60; sep = sep || ','; for (const s of arr) { /* istanbul ignore next */ if (s === undefined) continue; line += k > 0 ? sep : ''; if (line.length > lfLen) { out += (out ? '\n' : '') + line; line = ''; } else line += line ? ' ' : ''; line += s; k++; } if (line) out += (out ? '\n' : '') + line; return out; }