(source: string)
| 205 | } |
| 206 | |
| 207 | export function getInlineScriptSyntaxError(source: string): string | null { |
| 208 | if (!source.trim()) return null; |
| 209 | try { |
| 210 | // eslint-disable-next-line no-new-func |
| 211 | new Function(source); |
| 212 | return null; |
| 213 | } catch (error) { |
| 214 | if (error instanceof Error) return error.message; |
| 215 | return String(error); |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | // fallow-ignore-next-line complexity |
| 220 | export function stripJsComments(source: string): string { |