Skip to content

feat: add json to tsv and tsv to json#155

Open
siddiqus wants to merge 1 commit intojamdotdev:mainfrom
siddiqus:feature/json-tsv
Open

feat: add json to tsv and tsv to json#155
siddiqus wants to merge 1 commit intojamdotdev:mainfrom
siddiqus:feature/json-tsv

Conversation

@siddiqus
Copy link

Summary

  • Implement JSON to TSV and TSV to JSON converter utilities
  • Add utilities to tools list
  • Update documentation accordingly
image image

@peckz peckz requested a review from Copilot March 5, 2026 18:37
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const json = convertTSVtoJSON(value.trim(), lowercase);
setOutput(json);
} catch (errorMessage: unknown) {
setOutput(errorMessage as string);
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

The caught value is an Error object (thrown by convertTSVtoJSON via throw new Error(...)), but it is cast directly to string. This will display [object Error] in the output textarea instead of the actual error message. You should use (errorMessage instanceof Error ? errorMessage.message : String(errorMessage)) to extract the message properly.

Suggested change
setOutput(errorMessage as string);
const message =
errorMessage instanceof Error
? errorMessage.message
: String(errorMessage);
setOutput(message);

Copilot uses AI. Check for mistakes.
Comment on lines +92 to +93
} catch (errorMessage: unknown) {
setOutput(errorMessage as string);
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

Same issue as the handleChange catch block: the caught Error object is cast directly to string, which will display [object Error] instead of the actual error message. Use (errorMessage instanceof Error ? errorMessage.message : String(errorMessage)) to properly extract the message.

Copilot uses AI. Check for mistakes.
const tsv = convertJSONtoTSV(value.trim());
setOutput(tsv);
} catch (errorMessage: unknown) {
setOutput(errorMessage as string);
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

The caught value is an Error object (thrown by convertJSONtoTSV via throw new Error(...)), but it is cast directly to string. This will display [object Error] in the output textarea instead of the actual error message. Use (errorMessage instanceof Error ? errorMessage.message : String(errorMessage)) to properly extract the message.

Suggested change
setOutput(errorMessage as string);
const message =
errorMessage instanceof Error
? errorMessage.message
: String(errorMessage);
setOutput(message);

Copilot uses AI. Check for mistakes.
handleChange({
currentTarget: { value: SAMPLE_DATA },
} as React.ChangeEvent<HTMLTextAreaElement>);
}, []);
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

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

handleFillSampleData uses handleChange in its body but has an empty dependency array []. This means it captures a stale reference to the initial handleChange. If the user toggles the "lowercase keys" checkbox and then clicks "Fill Sample Data", the conversion will ignore the lowercase setting because the stale handleChange still closes over lowercase = false. Add handleChange to the dependency array.

Suggested change
}, []);
}, [handleChange]);

Copilot uses AI. Check for mistakes.
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.

3 participants