options.js 693 B

12345678910111213141516171819202122
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.flatten = void 0;
  4. var tslib_1 = require("tslib");
  5. var defaultOpts = {
  6. xml: false,
  7. decodeEntities: true,
  8. };
  9. /** Cheerio default options. */
  10. exports.default = defaultOpts;
  11. var xmlModeDefault = {
  12. _useHtmlParser2: true,
  13. xmlMode: true,
  14. };
  15. function flatten(options) {
  16. return (options === null || options === void 0 ? void 0 : options.xml)
  17. ? typeof options.xml === 'boolean'
  18. ? xmlModeDefault
  19. : tslib_1.__assign(tslib_1.__assign({}, xmlModeDefault), options.xml)
  20. : options !== null && options !== void 0 ? options : undefined;
  21. }
  22. exports.flatten = flatten;