json-schema-to-typescript icon indicating copy to clipboard operation
json-schema-to-typescript copied to clipboard

perf: remove blank character at the beginning of string result

Open sangle7 opened this issue 3 years ago • 0 comments

When I try to read a file encoding in utf-8 BOM, it return a string with a "blank" as first character, I looked into the code and found this error:

SyntaxError: Unexpected token  in JSON at position 0
    at JSON.parse (<anonymous>)
    at compileFromFile  (....)

Thus, I believe we should add a trim to remove the blank characters

Related issue: https://github.com/nodejs/node/issues/20649

sangle7 avatar Sep 21 '22 01:09 sangle7