CSNW / sql-bricks

Transparent, Schemaless SQL Generation
http://csnw.github.io/sql-bricks
MIT License
203 stars 25 forks source link

Using clone() on a query throws an error. #118

Closed michaldrabik closed 4 years ago

michaldrabik commented 4 years ago
  const query = sql().select(`c.id AS "id"`)
    .from('competitions c')
    .where(sql('c.id = 999'))

  const cloned = query.clone()

Running this simple example causes clone() to throw with following error:

Cannot read property 'apply' of undefined\n at /home//node_modules/sql-bricks/nodemodules /underscore/underscore.js:229:48\n at Array.map ()\n at Function..map._.collect (/home//node_modules/sql-bricks/node_modules/underscore/underscore.js:97:56)

prust commented 4 years ago

@michaldrabik: Thanks so much for reporting this! As you saw, it's fixed in #119. I deployed the fix to npm as v2.0.5.