public_library_map/node_modules/cheerio/lib/cheerio.js

66 lines
2.6 KiB
JavaScript
Raw Normal View History

2021-11-24 19:46:47 +11:00
"use strict";
2022-09-03 17:12:22 +10:00
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
2021-11-24 19:46:47 +11:00
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cheerio = void 0;
2022-09-03 17:12:22 +10:00
var Attributes = __importStar(require("./api/attributes.js"));
var Traversing = __importStar(require("./api/traversing.js"));
var Manipulation = __importStar(require("./api/manipulation.js"));
var Css = __importStar(require("./api/css.js"));
var Forms = __importStar(require("./api/forms.js"));
2021-11-24 19:46:47 +11:00
var Cheerio = /** @class */ (function () {
/**
* Instance of cheerio. Methods are specified in the modules. Usage of this
2022-09-03 17:12:22 +10:00
* constructor is not recommended. Please use `$.load` instead.
2021-11-24 19:46:47 +11:00
*
* @private
2022-09-03 17:12:22 +10:00
* @param elements - The new selection.
2021-11-24 19:46:47 +11:00
* @param root - Sets the root node.
* @param options - Options for the instance.
*/
2022-09-03 17:12:22 +10:00
function Cheerio(elements, root, options) {
2021-11-24 19:46:47 +11:00
this.length = 0;
this.options = options;
2022-09-03 17:12:22 +10:00
this._root = root;
2021-11-24 19:46:47 +11:00
if (elements) {
2022-09-03 17:12:22 +10:00
for (var idx = 0; idx < elements.length; idx++) {
this[idx] = elements[idx];
}
2021-11-24 19:46:47 +11:00
this.length = elements.length;
}
}
return Cheerio;
}());
exports.Cheerio = Cheerio;
/** Set a signature of the object. */
Cheerio.prototype.cheerio = '[cheerio object]';
/*
* Make cheerio an array-like object
*/
Cheerio.prototype.splice = Array.prototype.splice;
// Support for (const element of $(...)) iteration:
Cheerio.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
// Plug in the API
Object.assign(Cheerio.prototype, Attributes, Traversing, Manipulation, Css, Forms);
2022-09-03 17:12:22 +10:00
//# sourceMappingURL=cheerio.js.map