0.1.13 • Published 2 years ago

formdata-schema v0.1.13

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

formdata-schema

Parse your FormData with a simple schema.

Installation

pnpm i formdata-schema

Usage

import { parse } from 'formdata-schema'

// data: FormData
const parsed = parse(data, {
	first_name: 'nonempty',
	last_name: 'nonempty',
	height: 'number',
	birthdate: 'date',
	avatar: 'fileOptional',
	note: 'text',
})

Type of parsed:

Error | {
    first_name: string // length > 0
    last_name: string // length > 0
    height: number
    birthdate: Date
    avatar: File | null
    note: string
}
0.1.13

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago