Extract and set form values through the DOM—no frameworks required! https://github.com/TheoryOfNekomata/formxtra
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

13 regels
325 B

  1. export const makeSearchParams = (beforeValues) => Object
  2. .entries(beforeValues)
  3. .reduce(
  4. (beforeSearchParams, [key, value]) => {
  5. const theValue = !Array.isArray(value) ? [value] : value
  6. theValue.forEach(v => {
  7. beforeSearchParams.append(key, v)
  8. })
  9. return beforeSearchParams
  10. },
  11. new URLSearchParams()
  12. )