Skip to content

[ 🧹 ] Editorconfig , Querystring Replacement , Shorter Test Video#9

Open
PhoneDroid wants to merge 4 commits into
DjDeveloperr:mainfrom
PhoneDroid:main
Open

[ 🧹 ] Editorconfig , Querystring Replacement , Shorter Test Video#9
PhoneDroid wants to merge 4 commits into
DjDeveloperr:mainfrom
PhoneDroid:main

Conversation

@PhoneDroid
Copy link
Copy Markdown

@PhoneDroid PhoneDroid commented Jun 30, 2023

( Check the inidivual commits for changes instead of the File Changes tab -> editorconfig was applied to all files )

  • Added editorconfig for basic consistency
  • Applied editorconfig to all files
  • Replaced deprecated querystring library with standard URLSearchParams API
  • Replaced test video for shorter + much smaller filesize one

closes #10

Comment thread src/info.ts
url.searchParams.set("html5", "1");
let body = await request(url.toString(), options).then((e) => e.text());
let info = querystring.decode(body);
let info = Object.fromEntries([ ... new URLSearchParams(body).entries() ]);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think you can simply do Object.fromEntries(new URLSearchParams(body))

Comment thread src/info_extras.ts
.map((e: any) => qs.parse(e));
.map((e: any) => new URLSearchParams(e))
.map(( params ) => [ ... params.entries() ] )
.map(( params ) => Object.fromEntries(params) );
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

FYI this is an array, not a lazy iterator where chained maps can combine for less time complexity. This is going to iterate over the params 3 * n times. Just do

.map((e: any) => Object.fromEntries(new URLSearchParams(e)))

Comment thread .editorconfig

[*.md]

trim_trailing_whitespace = false No newline at end of file
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What about this instead? I think the comment at top is unnecessary and the ident size should be 2.

root = true

[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true

@DjDeveloperr
Copy link
Copy Markdown
Owner

Thanks for the PR! After it is landed, I will setup formatting & linting via deno fmt and deno lint in CI.

Unrelated but I recommend making PRs from non-main branch, so it allows maintainers to make changes to the PR!

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.

[npm] deprecated querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

2 participants