From 20c14e793e7a42342d136d8f13cb582878a7c004 Mon Sep 17 00:00:00 2001 From: Andrew Cantino Date: Wed, 30 Sep 2020 17:17:11 -0700 Subject: [PATCH] Rename variable to not shadow the internal memory constant --- examples/contextModifiers/notes.md | 4 ++-- examples/contextModifiers/reimplementAuthorsNote.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/contextModifiers/notes.md b/examples/contextModifiers/notes.md index c4fcacd..137fa9e 100644 --- a/examples/contextModifiers/notes.md +++ b/examples/contextModifiers/notes.md @@ -38,7 +38,7 @@ Set a note by typing `note: ` when in Do mode. It will be tagged to whatever the const modifier = (text) => { state.notes = state.notes || [] - const memory = text.slice(0, info.memoryLength || 0) + const contextMemory = text.slice(0, info.memoryLength || 0) let context = info.memoryLength ? text.slice(info.memoryLength + 1) : text // Assumes that the notes are sorted from oldest to newest. @@ -61,7 +61,7 @@ const modifier = (text) => { // Make sure the new context isn't too long, or it will get truncated by the server. context = context.slice(-(info.maxChars - info.memoryLength)) - const finalText = [memory, context].join("\n") + const finalText = [contextMemory, context].join("\n") return { text: finalText } } diff --git a/examples/contextModifiers/reimplementAuthorsNote.js b/examples/contextModifiers/reimplementAuthorsNote.js index cab1868..986029d 100644 --- a/examples/contextModifiers/reimplementAuthorsNote.js +++ b/examples/contextModifiers/reimplementAuthorsNote.js @@ -6,7 +6,7 @@ // This modifier re-implements Author's Note as an example. const modifier = (text) => { - const memory = info.memoryLength ? text.slice(0, info.memoryLength) : '' + const contextMemory = info.memoryLength ? text.slice(0, info.memoryLength) : '' const context = info.memoryLength ? text.slice(info.memoryLength + 1) : text const lines = context.split("\n") if (lines.length > 2) { @@ -15,7 +15,7 @@ const modifier = (text) => { } // Make sure the new context isn't too long, or it will get truncated by the server. const combinedLines = lines.join("\n").slice(-(info.maxChars - info.memoryLength)) - const finalText = [memory, combinedLines].join("") + const finalText = [contextMemory, combinedLines].join("") return { text: finalText } }