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/braces/lib/ |
Upload File : |
'use strict'; var extend = require('extend-shallow'); var Snapdragon = require('snapdragon'); var compilers = require('./compilers'); var parsers = require('./parsers'); var utils = require('./utils'); /** * Customize Snapdragon parser and renderer */ function Braces(options) { this.options = extend({}, options); } /** * Initialize braces */ Braces.prototype.init = function(options) { if (this.isInitialized) return; this.isInitialized = true; var opts = utils.createOptions({}, this.options, options); this.snapdragon = this.options.snapdragon || new Snapdragon(opts); this.compiler = this.snapdragon.compiler; this.parser = this.snapdragon.parser; compilers(this.snapdragon, opts); parsers(this.snapdragon, opts); /** * Call Snapdragon `.parse` method. When AST is returned, we check to * see if any unclosed braces are left on the stack and, if so, we iterate * over the stack and correct the AST so that compilers are called in the correct * order and unbalance braces are properly escaped. */ utils.define(this.snapdragon, 'parse', function(pattern, options) { var parsed = Snapdragon.prototype.parse.apply(this, arguments); this.parser.ast.input = pattern; var stack = this.parser.stack; while (stack.length) { addParent({type: 'brace.close', val: ''}, stack.pop()); } function addParent(node, parent) { utils.define(node, 'parent', parent); parent.nodes.push(node); } // add non-enumerable parser reference utils.define(parsed, 'parser', this.parser); return parsed; }); }; /** * Decorate `.parse` method */ Braces.prototype.parse = function(ast, options) { if (ast && typeof ast === 'object' && ast.nodes) return ast; this.init(options); return this.snapdragon.parse(ast, options); }; /** * Decorate `.compile` method */ Braces.prototype.compile = function(ast, options) { if (typeof ast === 'string') { ast = this.parse(ast, options); } else { this.init(options); } return this.snapdragon.compile(ast, options); }; /** * Expand */ Braces.prototype.expand = function(pattern) { var ast = this.parse(pattern, {expand: true}); return this.compile(ast, {expand: true}); }; /** * Optimize */ Braces.prototype.optimize = function(pattern) { var ast = this.parse(pattern, {optimize: true}); return this.compile(ast, {optimize: true}); }; /** * Expose `Braces` */ module.exports = Braces;