forms.d.ts 950 B

123456789101112131415161718192021222324252627282930313233343536
  1. import { type AnyNode } from 'domhandler';
  2. import type { Cheerio } from '../cheerio.js';
  3. /**
  4. * Encode a set of form elements as a string for submission.
  5. *
  6. * @category Forms
  7. * @example
  8. *
  9. * ```js
  10. * $('<form><input name="foo" value="bar" /></form>').serialize();
  11. * //=> 'foo=bar'
  12. * ```
  13. *
  14. * @returns The serialized form.
  15. * @see {@link https://api.jquery.com/serialize/}
  16. */
  17. export declare function serialize<T extends AnyNode>(this: Cheerio<T>): string;
  18. /**
  19. * Encode a set of form elements as an array of names and values.
  20. *
  21. * @category Forms
  22. * @example
  23. *
  24. * ```js
  25. * $('<form><input name="foo" value="bar" /></form>').serializeArray();
  26. * //=> [ { name: 'foo', value: 'bar' } ]
  27. * ```
  28. *
  29. * @returns The serialized form.
  30. * @see {@link https://api.jquery.com/serializeArray/}
  31. */
  32. export declare function serializeArray<T extends AnyNode>(this: Cheerio<T>): {
  33. name: string;
  34. value: string;
  35. }[];
  36. //# sourceMappingURL=forms.d.ts.map