Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.map(v =>
is_string(v) ? [{ text: columnize(v) }, { text: ', ' }] :
is_tag(v) ? [v(), { text: ', ' }] :
[{ text: Object.entries(v).map(v => v.map(dq).join(' AS ')).join(', ')}, { text: ', ' }]));
sqls.pop();
each(me => {
while (!(last(cur).depth < me.depth)) cur.pop();
const left = last(cur);
if (me.rel_type == '-') {
me.left_key = me.left_key || (me.is_poly ? 'id' : singular(me.table) + '_id');
me.key = me.key || (me.is_poly ? 'attached_id' : 'id');
left.left_joins.push(me);
} else {
me.left_key = me.left_key || 'id';
me.key = me.key || (me.is_poly ? 'attached_id' : singular(left.table) + '_id');
}
left.rels.push(me);
me.poly_type = me.is_poly ?
SQL `AND ${EQ(
is_string(me.poly_type) ? { attached_type: me.poly_type || left.table } : me.poly_type
)}` : tag();
cur.push(me);
}, rest);
return left;
map(c => is_string(c) ? me.as + '.' + c : c),
uniq)) :