joaquimserafim / is-json

check if a string is a valid JSON string in JavaScript without using Try/Catch
ISC License
74 stars 15 forks source link

Why? #14

Closed stevenvachon closed 4 years ago

stevenvachon commented 4 years ago

I don't get it and am curious about why I'd use this over the try/catch approach.

joaquimserafim commented 4 years ago

Hi mate you shouldn’t be curious at all With this :) quick answer in the past JS engines like V8 had some perf issues with ops like try/catch and this lib uses part of the algorithm from Crockford to check if is a valid JSON, you don’t need this at all this days, hope this helps you and stay safe!

stevenvachon commented 4 years ago

Thank you