UNPKG

@nestjs/graphql

Version:

Nest - modern, fast, powerful node.js web framework (@graphql)

13 lines (12 loc) 370 B
export function stringifyWithoutQuotes(obj, includeSpaces) { let result = includeSpaces ? JSON.stringify(obj, null, 2) : JSON.stringify(obj); result = result .replace(/"([^"]+)":/g, '$1:') .replace(/(?<char>({|,|:))/g, '$<char> '); if (!includeSpaces) { result = result.replace(/}/g, ' }'); } return result; }