mirror of
https://github.com/jorgev259/soc_site-astro.git
synced 2025-06-29 07:57:41 +00:00
Simply formData parsing
This commit is contained in:
parent
0e6e08beb2
commit
12063db819
2 changed files with 15 additions and 5 deletions
|
|
@ -2,3 +2,13 @@ import slugify from 'slugify'
|
|||
|
||||
export const Status = (status: number, statusText?: string) => new Response(null, { status, statusText })
|
||||
export const slug = (text: string) => slugify(text, { lower: true, strict: true })
|
||||
|
||||
export function formToObject(formData: FormData) {
|
||||
const object: Record<string, any> = {}
|
||||
for (const entry of formData.entries()) {
|
||||
const [key, value] = entry
|
||||
object[key] = value
|
||||
}
|
||||
|
||||
return object
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue