public_library_map/node_modules/cheerio/lib/api/forms.d.ts

38 lines
1,003 B
TypeScript
Raw Normal View History

2022-09-03 17:12:22 +10:00
import type { AnyNode } from 'domhandler';
import type { Cheerio } from '../cheerio.js';
2021-11-24 19:46:47 +11:00
/**
* Encode a set of form elements as a string for submission.
*
* @category Forms
2022-09-03 17:12:22 +10:00
* @example
*
* ```js
* $('<form><input name="foo" value="bar" /></form>').serialize();
* //=> 'foo=bar'
* ```
*
2021-11-24 19:46:47 +11:00
* @returns The serialized form.
* @see {@link https://api.jquery.com/serialize/}
*/
2022-09-03 17:12:22 +10:00
export declare function serialize<T extends AnyNode>(this: Cheerio<T>): string;
2021-11-24 19:46:47 +11:00
interface SerializedField {
name: string;
value: string;
}
/**
* Encode a set of form elements as an array of names and values.
*
* @category Forms
* @example
*
* ```js
* $('<form><input name="foo" value="bar" /></form>').serializeArray();
* //=> [ { name: 'foo', value: 'bar' } ]
* ```
*
* @returns The serialized form.
* @see {@link https://api.jquery.com/serializeArray/}
*/
2022-09-03 17:12:22 +10:00
export declare function serializeArray<T extends AnyNode>(this: Cheerio<T>): SerializedField[];
2021-11-24 19:46:47 +11:00
export {};
//# sourceMappingURL=forms.d.ts.map