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/regenerator-transform/src/ |
Upload File : |
import * as t from "babel-types"; import * as util from "./util"; // this function converts a shorthand object generator method into a normal // (non-shorthand) object property which is a generator function expression. for // example, this: // // var foo = { // *bar(baz) { return 5; } // } // // should be replaced with: // // var foo = { // bar: function*(baz) { return 5; } // } // // to do this, it clones the parameter array and the body of the object generator // method into a new FunctionExpression. // // this method can be passed any Function AST node path, and it will return // either: // a) the path that was passed in (iff the path did not need to be replaced) or // b) the path of the new FunctionExpression that was created as a replacement // (iff the path did need to be replaced) // // In either case, though, the caller can count on the fact that the return value // is a Function AST node path. // // If this function is called with an AST node path that is not a Function (or with an // argument that isn't an AST node path), it will throw an error. export default function replaceShorthandObjectMethod(path) { if (!path.node || !t.isFunction(path.node)) { throw new Error("replaceShorthandObjectMethod can only be called on Function AST node paths."); } // this function only replaces shorthand object methods (called ObjectMethod // in Babel-speak). if (!t.isObjectMethod(path.node)) { return path; } // this function only replaces generators. if (!path.node.generator) { return path; } const parameters = path.node.params.map(function (param) { return t.cloneDeep(param); }) const functionExpression = t.functionExpression( null, // id parameters, // params t.cloneDeep(path.node.body), // body path.node.generator, path.node.async ); util.replaceWithOrRemove(path, t.objectProperty( t.cloneDeep(path.node.key), // key functionExpression, //value path.node.computed, // computed false // shorthand ) ); // path now refers to the ObjectProperty AST node path, but we want to return a // Function AST node path for the function expression we created. we know that // the FunctionExpression we just created is the value of the ObjectProperty, // so return the "value" path off of this path. return path.get("value"); }