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/reduce-function-call/ |
Upload File : |
/* * Module dependencies */ var balanced = require("balanced-match") /** * Expose `reduceFunctionCall` * * @type {Function} */ module.exports = reduceFunctionCall /** * Walkthrough all expressions, evaluate them and insert them into the declaration * * @param {Array} expressions * @param {Object} declaration */ function reduceFunctionCall(string, functionRE, callback) { var call = string return getFunctionCalls(string, functionRE).reduce(function(string, obj) { return string.replace(obj.functionIdentifier + "(" + obj.matches.body + ")", evalFunctionCall(obj.matches.body, obj.functionIdentifier, callback, call, functionRE)) }, string) } /** * Parses expressions in a value * * @param {String} value * @returns {Array} * @api private */ function getFunctionCalls(call, functionRE) { var expressions = [] var fnRE = typeof functionRE === "string" ? new RegExp("\\b(" + functionRE + ")\\(") : functionRE do { var searchMatch = fnRE.exec(call) if (!searchMatch) { return expressions } if (searchMatch[1] === undefined) { throw new Error("Missing the first couple of parenthesis to get the function identifier in " + functionRE) } var fn = searchMatch[1] var startIndex = searchMatch.index var matches = balanced("(", ")", call.substring(startIndex)) if (!matches || matches.start !== searchMatch[0].length - 1) { throw new SyntaxError(fn + "(): missing closing ')' in the value '" + call + "'") } expressions.push({matches: matches, functionIdentifier: fn}) call = matches.post } while (fnRE.test(call)) return expressions } /** * Evaluates an expression * * @param {String} expression * @returns {String} * @api private */ function evalFunctionCall (string, functionIdentifier, callback, call, functionRE) { // allow recursivity return callback(reduceFunctionCall(string, functionRE, callback), functionIdentifier, call) }