UNPKG

pgsql-deparser

Version:
23 lines (22 loc) 586 B
export class ListUtils { static unwrapList(obj) { if (obj === undefined || obj === null) { return []; } if (obj.List !== undefined) { return obj.List.items || []; } if (Array.isArray(obj)) { return obj; } return [obj]; } static formatList(items, separator = ', ', prefix = '', formatter) { if (!items || items.length === 0) { return ''; } return items .map(item => `${prefix}${formatter(item)}`) .join(separator); } }