@trenskow/pged 5.0.14 → 5.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/query-builder.js +9 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trenskow/pged",
3
- "version": "5.0.14",
3
+ "version": "5.0.16",
4
4
  "description": "Just a silly little db management and query builder for PostgreSQL.",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/query-builder.js CHANGED
@@ -67,11 +67,13 @@ export default class QueryBuilder extends CustomPromise {
67
67
  }
68
68
 
69
69
  select(keys = ['*']) {
70
- if (!Array.isArray(keys)) {
71
- keys = [].concat(...keys.split('"').map((key, idx) => {
72
- if (idx % 2 == 0) return key.split(/, ?/);
73
- return [key];
74
- })).filter((key) => key);
70
+ if (typeof keys !== 'string' || keys[0] !== ':') {
71
+ if (!Array.isArray(keys)) {
72
+ keys = [].concat(...keys.split('"').map((key, idx) => {
73
+ if (idx % 2 == 0) return key.split(/, ?/);
74
+ return [key];
75
+ })).filter((key) => key);
76
+ }
75
77
  }
76
78
  this._selectKeys = (this._selectKeys || []).concat(keys);
77
79
  return this;
@@ -472,7 +474,7 @@ export default class QueryBuilder extends CustomPromise {
472
474
  _buildUpdateKeysAndValues(keys, values) {
473
475
  return `set ${keys.map((key, idx) => {
474
476
  let value = values[idx];
475
- if (typeof value === 'undefined' || value == null) {
477
+ if (value == null) {
476
478
  value = 'null';
477
479
  } else if (/^:/.test(value)) {
478
480
  value = value.substring(1);
@@ -637,4 +639,4 @@ export default class QueryBuilder extends CustomPromise {
637
639
  .catch((error) => this._reject(error));
638
640
  }
639
641
 
640
- };
642
+ }