From 258920c73aa036106b6d7b234643ee7c97ee9b5c Mon Sep 17 00:00:00 2001
From: Tobias Speicher <rootcommander@gmail.com>
Date: Fri, 25 Mar 2022 20:06:08 +0100
Subject: [PATCH] refactor: replace deprecated String.prototype.substr()

.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
---
 src/backend/function-node.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/function-node.js b/src/backend/function-node.js
index 13150609..d00fa87f 100644
--- a/src/backend/function-node.js
+++ b/src/backend/function-node.js
@@ -966,7 +966,7 @@ class FunctionNode {
     }
 
     const debugString = utils.getAstString(this.source, ast);
-    const leadingSource = this.source.substr(ast.start);
+    const leadingSource = this.source.slice(ast.start);
     const splitLines = leadingSource.split(/\n/);
     const lineBefore = splitLines.length > 0 ? splitLines[splitLines.length - 1] : 0;
     return new Error(`${error} on line ${ splitLines.length }, position ${ lineBefore.length }:\n ${ debugString }`);