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

#619 chore: get rid of $.param #632

Merged
merged 1 commit into from
Jan 13, 2024
Merged

Conversation

pomm0
Copy link

@pomm0 pomm0 commented Jan 8, 2024

fixes #619.

In order to remain backwards-compatible I implemented the Array and Object handler similar as $.param is doing. Could also only use

(new URLSearchParams(queryParams)).toString()

but that is building array and object differently:
Selection_463

const params = {
  user_id: 5,
  comment_id: 1,
  hello: 'world',
  lorem: 'ipsum',
  reply_ids: [1, 2],
  search: {
    author: 'ember',
    topic: 'lts',
    deep: {
      my_array: [99, 77],
      my_value: true
    }
  }
};
const URLSearch = new URLSearchParams(params)
const jquery = $.param(params)
decodeURIComponent(URLSearch)
decodeURIComponent(jquery)

@ro0gr
Copy link
Collaborator

ro0gr commented Jan 11, 2024

Hey, this looks great! I'll take a closer look on it this weekend. Thank you.

@ro0gr ro0gr merged commit aac1b79 into san650:master Jan 13, 2024
14 checks passed
@pomm0 pomm0 deleted the chore/619-remove-jquery branch January 15, 2024 07:52
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.

get rid of $.param(
2 participants