index.d.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /// <reference types="node" />
  2. /**
  3. * The main types of Cheerio objects.
  4. *
  5. * @category Cheerio
  6. */
  7. export type { Cheerio } from './cheerio.js';
  8. /**
  9. * Types used in signatures of Cheerio methods.
  10. *
  11. * @category Cheerio
  12. */
  13. export * from './types.js';
  14. export type { CheerioOptions, HTMLParser2Options, Parse5Options, } from './options.js';
  15. /**
  16. * Re-exporting all of the node types.
  17. *
  18. * @category DOM Node
  19. */
  20. export type { Node, AnyNode, ParentNode, Element, Document } from 'domhandler';
  21. export type { CheerioAPI } from './load.js';
  22. /**
  23. * Create a querying function, bound to a document created from the provided markup.
  24. *
  25. * Note that similar to web browser contexts, this operation may introduce
  26. * `<html>`, `<head>`, and `<body>` elements; set `isDocument` to `false` to
  27. * switch to fragment mode and disable this.
  28. *
  29. * @param content - Markup to be loaded.
  30. * @param options - Options for the created instance.
  31. * @param isDocument - Allows parser to be switched to fragment mode.
  32. * @returns The loaded document.
  33. * @see {@link https://cheerio.js.org#loading} for additional usage information.
  34. */
  35. export declare const load: (content: string | import("domhandler").AnyNode | import("domhandler").AnyNode[] | Buffer, options?: import("./options.js").CheerioOptions | null | undefined, isDocument?: boolean) => import("./load.js").CheerioAPI;
  36. /**
  37. * The default cheerio instance.
  38. *
  39. * @deprecated Use the function returned by `load` instead.
  40. */
  41. declare const _default: import("./load.js").CheerioAPI;
  42. export default _default;
  43. export { html, xml, text } from './static.js';
  44. import * as staticMethods from './static.js';
  45. /**
  46. * In order to promote consistency with the jQuery library, users are encouraged
  47. * to instead use the static method of the same name.
  48. *
  49. * @deprecated
  50. * @example
  51. *
  52. * ```js
  53. * const $ = cheerio.load('<div><p></p></div>');
  54. *
  55. * $.contains($('div').get(0), $('p').get(0));
  56. * //=> true
  57. *
  58. * $.contains($('p').get(0), $('div').get(0));
  59. * //=> false
  60. * ```
  61. *
  62. * @returns {boolean}
  63. */
  64. export declare const contains: typeof staticMethods.contains;
  65. /**
  66. * In order to promote consistency with the jQuery library, users are encouraged
  67. * to instead use the static method of the same name.
  68. *
  69. * @deprecated
  70. * @example
  71. *
  72. * ```js
  73. * const $ = cheerio.load('');
  74. *
  75. * $.merge([1, 2], [3, 4]);
  76. * //=> [1, 2, 3, 4]
  77. * ```
  78. */
  79. export declare const merge: typeof staticMethods.merge;
  80. /**
  81. * In order to promote consistency with the jQuery library, users are encouraged
  82. * to instead use the static method of the same name as it is defined on the
  83. * "loaded" Cheerio factory function.
  84. *
  85. * @deprecated See {@link static/parseHTML}.
  86. * @example
  87. *
  88. * ```js
  89. * const $ = cheerio.load('');
  90. * $.parseHTML('<b>markup</b>');
  91. * ```
  92. */
  93. export declare const parseHTML: typeof staticMethods.parseHTML;
  94. /**
  95. * Users seeking to access the top-level element of a parsed document should
  96. * instead use the `root` static method of a "loaded" Cheerio function.
  97. *
  98. * @deprecated
  99. * @example
  100. *
  101. * ```js
  102. * const $ = cheerio.load('');
  103. * $.root();
  104. * ```
  105. */
  106. export declare const root: typeof staticMethods.root;
  107. //# sourceMappingURL=index.d.ts.map