MCPcopy
hub / github.com/whoiskatrin/sql-translator / addHistoryEntry

Function addHistoryEntry

pages/index.tsx:103–121  ·  view source on GitHub ↗
(entry: IHistory)

Source from the content-addressed store, hash-verified

101 };
102
103 const addHistoryEntry = (entry: IHistory) => {
104 if (
105 !history.some(
106 ({ inputText, outputText }) =>
107 inputText === entry.inputText && outputText === entry.outputText
108 ) &&
109 !prevquery.some(
110 ({ previnput, prevoutput }) =>
111 previnput === entry.inputText && prevoutput === entry.outputText
112 )
113 ) {
114 setHistory([...history, entry]);
115 }
116 const newhistory: prev = {
117 previnput: entry.inputText,
118 prevoutput: entry.outputText,
119 };
120 setPrevquery([...prevquery, newhistory]);
121 };
122
123 function safeJSONParse(str: string) {
124 try {

Callers 1

HomeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected