Comment

Comment by shouldbeworking

    function parseJson(str) {
      try {
        return JSON.parse(str);
      } catch (err) {
        if (err instanceof SyntaxError) {
          return undefined;
        } else {
          throw err;
        }
      }
    }

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton