mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-30 11:49:42 +02:00
Merge branch 'staging' into develop
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -127,6 +127,9 @@ export async function getSinceRaw (
|
||||
export function gqlp (params: Record<string, string | number | string[] | undefined>): string {
|
||||
let result = ''
|
||||
let first = true
|
||||
function escape (str: string): string {
|
||||
return str.replace(/"/g, '\\"')
|
||||
}
|
||||
for (const [k, v] of Object.entries(params)) {
|
||||
if (v !== undefined) {
|
||||
if (!first) {
|
||||
@@ -136,9 +139,9 @@ export function gqlp (params: Record<string, string | number | string[] | undefi
|
||||
if (typeof v === 'number') {
|
||||
result += `${k}: ${v}`
|
||||
} else if (Array.isArray(v)) {
|
||||
result += `${k}: [${v.map((it) => `"${it}"`).join(', ')}]`
|
||||
result += `${k}: [${v.map((it) => `"${escape(it)}"`).join(', ')}]`
|
||||
} else {
|
||||
result += `${k}: "${v}"`
|
||||
result += `${k}: "${escape(v)}"`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user