Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON extension: v2.6 #1212

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions extensions/Skyhigh173/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,13 @@
json_is_valid({ json }) {
if (typeof json != "string") {
return false;
}
json = json.trim();
if (
(json.slice(0, 1) != "[" || json.slice(-1) != "]") &&
Copy link
Member

Choose a reason for hiding this comment

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

why cant you just do json[0] or json.at(0) and json.at(-1), is there any benifit?, this isnt a review bc im just curious lol

Copy link
Member

Choose a reason for hiding this comment

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

why did it pop up like a review :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's a conflict from #1596
So I copied the code from there
Perhaps I can change it after this
🤷

(json.slice(0, 1) != "{" || json.slice(-1) != "}")
) {
return false;
} else {
try {
JSON.parse(json);
Expand Down
Loading