MCPcopy Create free account
hub / github.com/REditorSupport/vscode-R / ToRStringLiteral

Function ToRStringLiteral

src/util.ts:148–164  ·  view source on GitHub ↗
(s: string, quote: string)

Source from the content-addressed store, hash-verified

146}
147
148export function ToRStringLiteral(s: string, quote: string): string {
149 if (s === undefined) {
150 return 'NULL';
151 }
152
153 return (quote +
154 s.replace(/\\/g, '\\\\')
155 .replace(/"""/g, `\\${quote}`)
156 .replace(/\\n/g, '\\n')
157 .replace(/\\r/g, '\\r')
158 .replace(/\\t/g, '\\t')
159 .replace(/\\b/g, '\\b')
160 .replace(/\\a/g, '\\a')
161 .replace(/\\f/g, '\\f')
162 .replace(/\\v/g, '\\v') +
163 quote);
164}
165
166export async function delay(ms: number): Promise<unknown> {
167 return new Promise((resolve) => setTimeout(resolve, ms));

Callers 1

makeDraftFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected