Skip to content

Commit

Permalink
fix: pass right apply context (#100)
Browse files Browse the repository at this point in the history
Reading the source code, I've noticed that:

```js
(this.values || this.bind).push.apply(this.values, statement.values)
  ^ if this is falsy                   ^ so is this one
```

This fix makes the code not fail when `useBind` and `append` are used in the wild.
  • Loading branch information
WebReflection authored and felixfbecker committed Feb 27, 2019
1 parent cc57fe7 commit 7be1d2a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Expand Up @@ -28,7 +28,8 @@ class SQLStatement {
if (statement instanceof SQLStatement) {
this.strings[this.strings.length - 1] += statement.strings[0]
this.strings.push.apply(this.strings, statement.strings.slice(1))
;(this.values || this.bind).push.apply(this.values, statement.values)
const list = this.values || this.bind
list.push.apply(list, statement.values)
} else {
this.strings[this.strings.length - 1] += statement
}
Expand Down

0 comments on commit 7be1d2a

Please sign in to comment.