Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@PhoneDroid
Copy link

@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

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
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))

.map((e: any) => qs.parse(e));
.map((e: any) => new URLSearchParams(e))
.map(( params ) => [ ... params.entries() ] )
.map(( params ) => Object.fromEntries(params) );
Copy link
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)))


[*.md]

trim_trailing_whitespace = false No newline at end of file
Copy link
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
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 [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

2 participants