@types/form-serialize
TypeScript icon, indicating that this package has built-in type declarations

0.7.4 • Public • Published

Installation

npm install --save @types/form-serialize

Summary

This package contains type definitions for form-serialize (https://github.com/defunctzombie/form-serialize#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/form-serialize.

index.d.ts

interface ResultHash {
    [key: string]: string | string[] | ResultHash;
}

interface Options<Result> {
    /** Configure the output type. If true, the output will be a js object. */
    hash?: boolean | undefined;
    /**
     * Optional serializer function to override the default one. The function takes 3 arguments (result, key,
     * value) and should return new result hash and url encoded str serializers are provided with this module
     */
    serializer?: ((result: Result, key: string, value: string) => Result) | undefined;
    /** If true serialize disabled fields. */
    disabled?: boolean | undefined;
    /** If true serialize empty fields */
    empty?: boolean | undefined;
}

interface OptionsHash extends Options<ResultHash> {
    hash: true;
}

interface OptionsString extends Options<string> {
    hash: false;
}

declare function serialize(form: HTMLFormElement, options: OptionsHash | true): ResultHash;
declare function serialize(form: HTMLFormElement, options?: OptionsString | false): string;
declare function serialize<Result = string>(form: HTMLFormElement, options?: Options<Result> | boolean): Result;

export = serialize;

Additional Details

  • Last updated: Tue, 07 Nov 2023 03:09:37 GMT
  • Dependencies: none

Credits

These definitions were written by Tyler Johnson.

/@types/form-serialize/

    Package Sidebar

    Install

    npm i @types/form-serialize

    Weekly Downloads

    3,410

    Version

    0.7.4

    License

    MIT

    Unpacked Size

    4.92 kB

    Total Files

    5

    Last publish

    Collaborators

    • types