@axiosleo/orm-mysql 0.5.3 → 0.5.4

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 +3 -2
  2. package/src/builder.js +4 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiosleo/orm-mysql",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "MySQL ORM tool",
5
5
  "keywords": [
6
6
  "mysql",
@@ -37,6 +37,7 @@
37
37
  "mm": "^3.2.0",
38
38
  "mocha": "^9.1.3",
39
39
  "mocha-sinon": "^2.1.2",
40
+ "nyc": "^15.1.0",
40
41
  "pre-commit": "^1.2.2",
41
42
  "sinon": "^9.0.2",
42
43
  "typescript": "^4.3.2"
@@ -47,4 +48,4 @@
47
48
  "lint"
48
49
  ]
49
50
  }
50
- }
51
+ }
package/src/builder.js CHANGED
@@ -193,8 +193,10 @@ class Builder {
193
193
  }
194
194
 
195
195
  _buildContidionIn(condition, isNot = false) {
196
- if (!Array.isArray(condition.value) && !(condition.value instanceof Query)) {
197
- throw new Error('Value must be an array for "IN" condition');
196
+ if (Array.isArray(condition.value) && !condition.value.length) {
197
+ throw new Error('Value must not be empty for "IN" condition');
198
+ } else if (!Array.isArray(condition.value) && !(condition.value instanceof Query)) {
199
+ throw new Error('Value must be an array or sub-query for "IN" condition');
198
200
  }
199
201
  if (condition.key.indexOf('$') !== -1) {
200
202
  let res = this._buildConditionValues(condition.value);