Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/cheerio/lib/ |
Upload File : |
var parse = require('./parse'), render = require('dom-serializer'); /** * HTML Tags */ var tags = { tag: true, script: true, style: true }; /** * Check if the DOM element is a tag * * isTag(type) includes <script> and <style> tags */ exports.isTag = function(type) { if (type.type) type = type.type; return tags[type] || false; }; /** * Convert a string to camel case notation. * @param {String} str String to be converted. * @return {String} String in camel case notation. */ exports.camelCase = function(str) { return str.replace(/[_.-](\w|$)/g, function(_, x) { return x.toUpperCase(); }); }; /** * Convert a string from camel case to "CSS case", where word boundaries are * described by hyphens ("-") and all characters are lower-case. * @param {String} str String to be converted. * @return {string} String in "CSS case". */ exports.cssCase = function(str) { return str.replace(/[A-Z]/g, '-$&').toLowerCase(); }; /** * Iterate over each DOM element without creating intermediary Cheerio instances. * * This is indented for use internally to avoid otherwise unnecessary memory pressure introduced * by _make. */ exports.domEach = function(cheerio, fn) { var i = 0, len = cheerio.length; while (i < len && fn.call(cheerio, i, cheerio[i]) !== false) ++i; return cheerio; }; /** * Create a deep copy of the given DOM structure by first rendering it to a * string and then parsing the resultant markup. * * @argument {Object} dom - The htmlparser2-compliant DOM structure * @argument {Object} options - The parsing/rendering options */ exports.cloneDom = function(dom, options) { return parse(render(dom, options), options).children; }; /* * A simple way to check for HTML strings or ID strings */ var quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/; /* * Check if string is HTML */ exports.isHtml = function(str) { // Faster than running regex, if str starts with `<` and ends with `>`, assume it's HTML if (str.charAt(0) === '<' && str.charAt(str.length - 1) === '>' && str.length >= 3) return true; // Run the regex var match = quickExpr.exec(str); return !!(match && match[1]); };