From 7be1d2ab54c345184eef690b6b824f60aa4ba219 Mon Sep 17 00:00:00 2001 From: Andrea Giammarchi Date: Wed, 27 Feb 2019 13:02:55 +0100 Subject: [PATCH] fix: pass right apply context (#100) 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. --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index c74bfb4..df956f1 100644 --- a/index.js +++ b/index.js @@ -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 }