Skip to content
Discussion options

You must be logged in to vote

this is cool (the bot).

rawCheck did the trick:

import * as v from "valibot"
import { formatBytes } from "$lib/utilities/formatBytes"

export type Options = {
    formats?: string[]
    size?: {
        min?: number
        max?: number
    }
}

/**
 * The `size` argument properties are considered to contain bytes as numbers.
 */
export const files = (options?: Options) =>
    v.pipe(
        v.array(
            v.pipe(
                v.file("Can't be empty!"),
                v.rawCheck(({ addIssue, dataset }) => {
                    if (!dataset.typed) return

                    if (options?.formats) {
                        if (!dataset.value.name.includes(".")) {

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@babakfp
Comment options

Answer selected by babakfp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant