Skip to content

Conversation

@crondinini
Copy link
Contributor

@crondinini crondinini commented Aug 30, 2023

Description

Needed to get the code lines without the highlighting, so I have introduced a new property for it.

Also fixes JSONError to be a class so that the instanceof comparison can be used in a Typescript codebase.

test.js Outdated
parseJson('{\n\t"foo": true,\n}', 'foo.json');
} catch (error) {
t.assert(error.codeFrame);
t.true(error.rawCodeFrame === ' 1 | {\n 2 | \t"foo": true,\n> 3 | }\n | ^');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use t.is()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@sindresorhus
Copy link
Owner

You need to add it to the readme and index.d.ts

@sindresorhus sindresorhus merged commit 9f3bd0b into sindresorhus:main Sep 1, 2023
@sindresorhus
Copy link
Owner

This was already merged and released.

SmushyTaco pushed a commit to SmushyTaco/parse-json that referenced this pull request Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants