Extract and set form values through the DOM—no frameworks required! https://github.com/TheoryOfNekomata/formxtra
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

13 lines
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. )