Fixed error with output
This commit is contained in:
parent
8a1ea6f029
commit
856d05558c
14
src/utils.ts
14
src/utils.ts
@ -648,17 +648,9 @@ export const jsonOutput = ({
|
|||||||
value: string | string[]
|
value: string | string[]
|
||||||
escape: boolean
|
escape: boolean
|
||||||
}): string => {
|
}): string => {
|
||||||
return JSON.stringify(value, (key, value) => {
|
let result = JSON.stringify(value)
|
||||||
if (typeof value === 'string') {
|
|
||||||
// if escape is true, escape quotes and backslashes
|
return escape ? result.replace(/"/g, '\\"') : result
|
||||||
return escape ? value.replace(/\\/g, '\\\\').replace(/"/g, '\\"') : value
|
|
||||||
} else if (Array.isArray(value)) {
|
|
||||||
return escape
|
|
||||||
? value.map(v => v.replace(/\\/g, '\\\\').replace(/"/g, '\\"'))
|
|
||||||
: value
|
|
||||||
}
|
|
||||||
return value
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getFilePatterns = async ({
|
export const getFilePatterns = async ({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user