summaryrefslogtreecommitdiff
path: root/includes/external/addressbook/node_modules/cheerio/lib/esm/parse.js
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2023-11-17 23:25:29 +0100
committerRaindropsSys <raindrops@equestria.dev>2023-11-17 23:25:29 +0100
commit953ddd82e48dd206cef5ac94456549aed13b3ad5 (patch)
tree8f003106ee2e7f422e5a22d2ee04d0db302e66c0 /includes/external/addressbook/node_modules/cheerio/lib/esm/parse.js
parent62a9199846b0c07c03218703b33e8385764f42d9 (diff)
downloadpluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.gz
pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.tar.bz2
pluralconnect-953ddd82e48dd206cef5ac94456549aed13b3ad5.zip
Updated 30 files and deleted 2976 files (automated)
Diffstat (limited to 'includes/external/addressbook/node_modules/cheerio/lib/esm/parse.js')
-rw-r--r--includes/external/addressbook/node_modules/cheerio/lib/esm/parse.js73
1 files changed, 0 insertions, 73 deletions
diff --git a/includes/external/addressbook/node_modules/cheerio/lib/esm/parse.js b/includes/external/addressbook/node_modules/cheerio/lib/esm/parse.js
deleted file mode 100644
index 781d6a4..0000000
--- a/includes/external/addressbook/node_modules/cheerio/lib/esm/parse.js
+++ /dev/null
@@ -1,73 +0,0 @@
-import { removeElement } from 'domutils';
-import { Document, isDocument as checkIsDocument, } from 'domhandler';
-/**
- * Get the parse function with options.
- *
- * @param parser - The parser function.
- * @returns The parse function with options.
- */
-export function getParse(parser) {
- /**
- * Parse a HTML string or a node.
- *
- * @param content - The HTML string or node.
- * @param options - The parser options.
- * @param isDocument - If `content` is a document.
- * @param context - The context node in the DOM tree.
- * @returns The parsed document node.
- */
- return function parse(content, options, isDocument, context) {
- if (typeof Buffer !== 'undefined' && Buffer.isBuffer(content)) {
- content = content.toString();
- }
- if (typeof content === 'string') {
- return parser(content, options, isDocument, context);
- }
- const doc = content;
- if (!Array.isArray(doc) && checkIsDocument(doc)) {
- // If `doc` is already a root, just return it
- return doc;
- }
- // Add conent to new root element
- const root = new Document([]);
- // Update the DOM using the root
- update(doc, root);
- return root;
- };
-}
-/**
- * Update the dom structure, for one changed layer.
- *
- * @param newChilds - The new children.
- * @param parent - The new parent.
- * @returns The parent node.
- */
-export function update(newChilds, parent) {
- // Normalize
- const arr = Array.isArray(newChilds) ? newChilds : [newChilds];
- // Update parent
- if (parent) {
- parent.children = arr;
- }
- else {
- parent = null;
- }
- // Update neighbors
- for (let i = 0; i < arr.length; i++) {
- const node = arr[i];
- // Cleanly remove existing nodes from their previous structures.
- if (node.parent && node.parent.children !== arr) {
- removeElement(node);
- }
- if (parent) {
- node.prev = arr[i - 1] || null;
- node.next = arr[i + 1] || null;
- }
- else {
- node.prev = node.next = null;
- }
- node.parent = parent;
- }
- return parent;
-}
-//# sourceMappingURL=parse.js.map \ No newline at end of file