Socket
Socket
Sign inDemoInstall

uglify-js

Package Overview
Dependencies
0
Maintainers
3
Versions
283
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.10.2 to 3.10.3

17

lib/ast.js

@@ -291,6 +291,9 @@ /***********************************************************************

node.walk(new TreeWalker(function(node) {
if (node instanceof AST_LoopControl && node.label && node.label.thedef === def) {
if (node instanceof AST_LoopControl) {
if (!node.label || node.label.thedef !== def) return;
node.label.thedef = label;
label.references.push(node);
return true;
}
if (node instanceof AST_Scope) return true;
}));

@@ -413,12 +416,12 @@ }

var AST_Scope = DEFNODE("Scope", "variables functions uses_with uses_eval parent_scope enclosed cname", {
var AST_Scope = DEFNODE("Scope", "cname enclosed uses_eval uses_with parent_scope functions variables make_def", {
$documentation: "Base class for all statements introducing a lexical scope",
$propdoc: {
variables: "[Object/S] a map of name -> SymbolDef for all variables/functions defined in this scope",
functions: "[Object/S] like `variables`, but only lists function declarations",
cname: "[integer/S] current index for mangling variables (used internally by the mangler)",
enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",
uses_eval: "[boolean/S] tells whether this scope contains a direct call to the global `eval`",
uses_with: "[boolean/S] tells whether this scope uses the `with` statement",
uses_eval: "[boolean/S] tells whether this scope contains a direct call to the global `eval`",
parent_scope: "[AST_Scope?/S] link to the parent scope",
enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",
cname: "[integer/S] current index for mangling variables (used internally by the mangler)",
functions: "[Object/S] like `variables`, but only lists function declarations",
variables: "[Object/S] a map of name -> SymbolDef for all variables/functions defined in this scope",
},

@@ -425,0 +428,0 @@ clone: function(deep) {

@@ -103,3 +103,3 @@ /***********************************************************************

var indentation = 0;
var indentation = options.indent_start;
var current_col = 0;

@@ -195,6 +195,2 @@ var current_line = 1;

function make_indent(back) {
return repeat_string(" ", options.indent_start + indentation - back * options.indent_level);
}
/* -----[ beautification/minification ]----- */

@@ -350,5 +346,3 @@

var indent = options.beautify ? function(half) {
if (options.beautify) {
print(make_indent(half ? 0.5 : 0));
}
print(repeat_string(" ", half ? indentation - (options.indent_level >> 1) : indentation));
} : noop;

@@ -581,5 +575,5 @@

indent : indent,
indentation : function() { return indentation },
current_width : function() { return current_col - indentation },
should_break : function() { return options.width && this.current_width() >= options.width },
should_break : readonly ? noop : function() {
return options.width && current_col - indentation >= options.width;
},
has_parens : function() { return has_parens },

@@ -637,9 +631,3 @@ newline : newline,

AST_Node.DEFMETHOD("print", function(stream, force_parens) {
var self = this, generator = self._codegen;
function doit() {
stream.prepend_comments(self);
self.add_source_map(stream);
generator(self, stream);
stream.append_comments(self);
}
var self = this;
stream.push_node(self);

@@ -652,5 +640,10 @@ if (force_parens || self.needs_parens(stream)) {

stream.pop_node();
function doit() {
stream.prepend_comments(self);
self.add_source_map(stream);
self._codegen(stream);
stream.append_comments(self);
}
});
AST_Node.DEFMETHOD("_print", AST_Node.prototype.print);
AST_Node.DEFMETHOD("print_to_string", function(options) {

@@ -698,4 +691,3 @@ var s = OutputStream(options);

var p = output.parent();
return p instanceof AST_PropAccess && p.expression === this
|| p instanceof AST_Call && p.expression === this;
return (p instanceof AST_Call || p instanceof AST_PropAccess) && p.expression === this;
});

@@ -705,19 +697,19 @@

var p = output.parent();
// (foo, bar)() or foo(1, (2, 3), 4)
return p instanceof AST_Call
// !(foo, bar, baz)
|| p instanceof AST_Unary
// [ 1, (2, 3), 4 ] ==> [ 1, 3, 4 ]
return p instanceof AST_Array
// 1 + (2, 3) + 4 ==> 8
|| p instanceof AST_Binary
// var a = (1, 2), b = a + a; ==> b == 4
|| p instanceof AST_VarDef
// new (foo, bar) or foo(1, (2, 3), 4)
|| p instanceof AST_Call
// (false, true) ? (a = 10, b = 20) : (c = 30)
// ==> 20 (side effect, set a := 10 and b := 20)
|| p instanceof AST_Conditional
// { foo: (1, 2) }.foo ==> 2
|| p instanceof AST_ObjectProperty
// (1, {foo:2}).foo or (1, {foo:2})["foo"] ==> 2
|| p instanceof AST_PropAccess && p.expression === this
// [ 1, (2, 3), 4 ] ==> [ 1, 3, 4 ]
|| p instanceof AST_Array
// { foo: (1, 2) }.foo ==> 2
|| p instanceof AST_ObjectProperty
// (false, true) ? (a = 10, b = 20) : (c = 30)
// ==> 20 (side effect, set a := 10 and b := 20)
|| p instanceof AST_Conditional;
// !(foo, bar, baz)
|| p instanceof AST_Unary
// var a = (1, 2), b = a + a; ==> b == 4
|| p instanceof AST_VarDef;
});

@@ -727,11 +719,2 @@

var p = output.parent();
// (foo && bar)()
if (p instanceof AST_Call && p.expression === this)
return true;
// typeof (foo && bar)
if (p instanceof AST_Unary)
return true;
// (foo && bar)["prop"], (foo && bar).prop
if (p instanceof AST_PropAccess && p.expression === this)
return true;
// this deals with precedence: 3 * (2 + 1)

@@ -741,14 +724,17 @@ if (p instanceof AST_Binary) {

var so = this.operator, sp = PRECEDENCE[so];
if (pp > sp
|| (pp == sp
&& this === p.right)) {
return true;
}
return pp > sp || (pp == sp && this === p.right);
}
// (foo && bar)()
if (p instanceof AST_Call) return p.expression === this;
// (foo && bar)["prop"], (foo && bar).prop
if (p instanceof AST_PropAccess) return p.expression === this;
// typeof (foo && bar)
if (p instanceof AST_Unary) return true;
});
PARENS(AST_PropAccess, function(output) {
var node = this;
var p = output.parent();
if (p instanceof AST_New && p.expression === this) {
// i.e. new (foo.bar().baz)
if (p instanceof AST_New && p.expression === node) {
// i.e. new (foo().bar)
//

@@ -759,11 +745,6 @@ // if there's one call into this subtree, then we need

// expression.
var parens = false;
this.walk(new TreeWalker(function(node) {
if (parens || node instanceof AST_Scope) return true;
if (node instanceof AST_Call) {
parens = true;
return true;
}
}));
return parens;
do {
node = node.expression;
} while (node instanceof AST_PropAccess);
return node.TYPE == "Call";
}

@@ -774,3 +755,3 @@ });

var p = output.parent();
if (p instanceof AST_New && p.expression === this) return true;
if (p instanceof AST_New) return p.expression === this;
// https://bugs.webkit.org/show_bug.cgi?id=123506

@@ -788,7 +769,8 @@ if (output.option('webkit')) {

PARENS(AST_New, function(output) {
if (need_constructor_parens(this, output)) return false;
var p = output.parent();
if (!need_constructor_parens(this, output)
&& (p instanceof AST_PropAccess // (new Date).getTime(), (new Date)["getTime"]()
|| p instanceof AST_Call && p.expression === this)) // (new foo)(bar)
return true;
// (new foo)(bar)
if (p instanceof AST_Call) return p.expression === this;
// (new Date).getTime(), (new Date)["getTime"]()
return p instanceof AST_PropAccess;
});

@@ -802,5 +784,3 @@

// https://github.com/mishoo/UglifyJS/pull/1009
if (value < 0 || /^0/.test(make_num(value))) {
return true;
}
return value < 0 || /^0/.test(make_num(value));
}

@@ -811,17 +791,12 @@ });

var p = output.parent();
// !(a = false) → true
if (p instanceof AST_Unary)
return true;
// 1 + (a = 2) + 3 → 6, side effect setting a = 2
if (p instanceof AST_Binary && !(p instanceof AST_Assign))
return true;
if (p instanceof AST_Binary) return !(p instanceof AST_Assign);
// (a = func)() —or— new (a = Object)()
if (p instanceof AST_Call && p.expression === this)
return true;
if (p instanceof AST_Call) return p.expression === this;
// (a = foo) ? bar : baz
if (p instanceof AST_Conditional && p.condition === this)
return true;
if (p instanceof AST_Conditional) return p.condition === this;
// (a = foo)["prop"] —or— (a = foo).prop
if (p instanceof AST_PropAccess && p.expression === this)
return true;
if (p instanceof AST_PropAccess) return p.expression === this;
// !(a = false) → true
if (p instanceof AST_Unary) return true;
});

@@ -831,5 +806,5 @@

DEFPRINT(AST_Directive, function(self, output) {
var quote = self.quote;
var value = self.value;
DEFPRINT(AST_Directive, function(output) {
var quote = this.quote;
var value = this.value;
switch (output.option("quote_style")) {

@@ -847,3 +822,3 @@ case 0:

});
DEFPRINT(AST_Debugger, function(self, output) {
DEFPRINT(AST_Debugger, function(output) {
output.print("debugger");

@@ -884,17 +859,17 @@ output.semicolon();

DEFPRINT(AST_Statement, function(self, output) {
self.body.print(output);
DEFPRINT(AST_Statement, function(output) {
this.body.print(output);
output.semicolon();
});
DEFPRINT(AST_Toplevel, function(self, output) {
display_body(self.body, true, output, true);
DEFPRINT(AST_Toplevel, function(output) {
display_body(this.body, true, output, true);
output.print("");
});
DEFPRINT(AST_LabeledStatement, function(self, output) {
self.label.print(output);
DEFPRINT(AST_LabeledStatement, function(output) {
this.label.print(output);
output.colon();
self.body.print(output);
this.body.print(output);
});
DEFPRINT(AST_SimpleStatement, function(self, output) {
self.body.print(output);
DEFPRINT(AST_SimpleStatement, function(output) {
this.body.print(output);
output.semicolon();

@@ -916,9 +891,10 @@ });

}
DEFPRINT(AST_BlockStatement, function(self, output) {
print_braced(self, output);
DEFPRINT(AST_BlockStatement, function(output) {
print_braced(this, output);
});
DEFPRINT(AST_EmptyStatement, function(self, output) {
DEFPRINT(AST_EmptyStatement, function(output) {
output.semicolon();
});
DEFPRINT(AST_Do, function(self, output) {
DEFPRINT(AST_Do, function(output) {
var self = this;
output.print("do");

@@ -935,3 +911,4 @@ output.space();

});
DEFPRINT(AST_While, function(self, output) {
DEFPRINT(AST_While, function(output) {
var self = this;
output.print("while");

@@ -945,3 +922,4 @@ output.space();

});
DEFPRINT(AST_For, function(self, output) {
DEFPRINT(AST_For, function(output) {
var self = this;
output.print("for");

@@ -975,3 +953,4 @@ output.space();

});
DEFPRINT(AST_ForIn, function(self, output) {
DEFPRINT(AST_ForIn, function(output) {
var self = this;
output.print("for");

@@ -989,3 +968,4 @@ output.space();

});
DEFPRINT(AST_With, function(self, output) {
DEFPRINT(AST_With, function(output) {
var self = this;
output.print("with");

@@ -1001,3 +981,3 @@ output.space();

/* -----[ functions ]----- */
AST_Lambda.DEFMETHOD("_do_print", function(output, nokeyword) {
DEFPRINT(AST_Lambda, function(output, nokeyword) {
var self = this;

@@ -1020,29 +1000,20 @@ if (!nokeyword) {

});
DEFPRINT(AST_Lambda, function(self, output) {
self._do_print(output);
});
/* -----[ jumps ]----- */
function print_jump(output, kind, target) {
output.print(kind);
if (target) {
output.space();
target.print(output);
}
output.semicolon();
function print_jump(kind, prop) {
return function(output) {
output.print(kind);
var target = this[prop];
if (target) {
output.space();
target.print(output);
}
output.semicolon();
};
}
DEFPRINT(AST_Return, print_jump("return", "value"));
DEFPRINT(AST_Throw, print_jump("throw", "value"));
DEFPRINT(AST_Break, print_jump("break", "label"));
DEFPRINT(AST_Continue, print_jump("continue", "label"));
DEFPRINT(AST_Return, function(self, output) {
print_jump(output, "return", self.value);
});
DEFPRINT(AST_Throw, function(self, output) {
print_jump(output, "throw", self.value);
});
DEFPRINT(AST_Break, function(self, output) {
print_jump(output, "break", self.label);
});
DEFPRINT(AST_Continue, function(self, output) {
print_jump(output, "continue", self.label);
});
/* -----[ if ]----- */

@@ -1075,3 +1046,4 @@ function make_then(self, output) {

}
DEFPRINT(AST_If, function(self, output) {
DEFPRINT(AST_If, function(output) {
var self = this;
output.print("if");

@@ -1098,3 +1070,4 @@ output.space();

/* -----[ switch ]----- */
DEFPRINT(AST_Switch, function(self, output) {
DEFPRINT(AST_Switch, function(output) {
var self = this;
output.print("switch");

@@ -1117,5 +1090,5 @@ output.space();

});
AST_SwitchBranch.DEFMETHOD("_do_print_body", function(output) {
function print_branch_body(self, output) {
output.newline();
this.body.forEach(function(stmt) {
self.body.forEach(function(stmt) {
output.indent();

@@ -1125,8 +1098,9 @@ stmt.print(output);

});
});
DEFPRINT(AST_Default, function(self, output) {
}
DEFPRINT(AST_Default, function(output) {
output.print("default:");
self._do_print_body(output);
print_branch_body(this, output);
});
DEFPRINT(AST_Case, function(self, output) {
DEFPRINT(AST_Case, function(output) {
var self = this;
output.print("case");

@@ -1136,7 +1110,8 @@ output.space();

output.print(":");
self._do_print_body(output);
print_branch_body(self, output);
});
/* -----[ exceptions ]----- */
DEFPRINT(AST_Try, function(self, output) {
DEFPRINT(AST_Try, function(output) {
var self = this;
output.print("try");

@@ -1154,3 +1129,4 @@ output.space();

});
DEFPRINT(AST_Catch, function(self, output) {
DEFPRINT(AST_Catch, function(output) {
var self = this;
output.print("catch");

@@ -1164,9 +1140,10 @@ output.space();

});
DEFPRINT(AST_Finally, function(self, output) {
DEFPRINT(AST_Finally, function(output) {
output.print("finally");
output.space();
print_braced(self, output);
print_braced(this, output);
});
DEFPRINT(AST_Var, function(self, output) {
DEFPRINT(AST_Var, function(output) {
var self = this;
output.print("var");

@@ -1196,3 +1173,4 @@ output.space();

DEFPRINT(AST_VarDef, function(self, output) {
DEFPRINT(AST_VarDef, function(output) {
var self = this;
self.name.print(output);

@@ -1221,7 +1199,8 @@ if (self.value) {

}
DEFPRINT(AST_Call, function(self, output) {
self.expression.print(output);
print_call_args(self, output);
DEFPRINT(AST_Call, function(output) {
this.expression.print(output);
print_call_args(this, output);
});
DEFPRINT(AST_New, function(self, output) {
DEFPRINT(AST_New, function(output) {
var self = this;
output.print("new");

@@ -1232,4 +1211,4 @@ output.space();

});
DEFPRINT(AST_Sequence, function(self, output) {
self.expressions.forEach(function(node, index) {
DEFPRINT(AST_Sequence, function(output) {
this.expressions.forEach(function(node, index) {
if (index > 0) {

@@ -1245,3 +1224,4 @@ output.comma();

});
DEFPRINT(AST_Dot, function(self, output) {
DEFPRINT(AST_Dot, function(output) {
var self = this;
var expr = self.expression;

@@ -1267,24 +1247,26 @@ expr.print(output);

});
DEFPRINT(AST_Sub, function(self, output) {
self.expression.print(output);
DEFPRINT(AST_Sub, function(output) {
this.expression.print(output);
output.print("[");
self.property.print(output);
this.property.print(output);
output.print("]");
});
DEFPRINT(AST_UnaryPrefix, function(self, output) {
var op = self.operator;
DEFPRINT(AST_UnaryPrefix, function(output) {
var op = this.operator;
var exp = this.expression;
output.print(op);
if (/^[a-z]/i.test(op)
|| (/[+-]$/.test(op)
&& self.expression instanceof AST_UnaryPrefix
&& /^[+-]/.test(self.expression.operator))) {
&& exp instanceof AST_UnaryPrefix
&& /^[+-]/.test(exp.operator))) {
output.space();
}
self.expression.print(output);
exp.print(output);
});
DEFPRINT(AST_UnaryPostfix, function(self, output) {
self.expression.print(output);
output.print(self.operator);
DEFPRINT(AST_UnaryPostfix, function(output) {
this.expression.print(output);
output.print(this.operator);
});
DEFPRINT(AST_Binary, function(self, output) {
DEFPRINT(AST_Binary, function(output) {
var self = this;
self.left.print(output);

@@ -1296,3 +1278,4 @@ output.space();

});
DEFPRINT(AST_Conditional, function(self, output) {
DEFPRINT(AST_Conditional, function(output) {
var self = this;
self.condition.print(output);

@@ -1309,6 +1292,6 @@ output.space();

/* -----[ literals ]----- */
DEFPRINT(AST_Array, function(self, output) {
output.with_square(function() {
var a = self.elements, len = a.length;
if (len > 0) output.space();
DEFPRINT(AST_Array, function(output) {
var a = this.elements, len = a.length;
output.with_square(len > 0 ? function() {
output.space();
a.forEach(function(exp, i) {

@@ -1323,8 +1306,9 @@ if (i) output.comma();

});
if (len > 0) output.space();
});
output.space();
} : noop);
});
DEFPRINT(AST_Object, function(self, output) {
if (self.properties.length > 0) output.with_block(function() {
self.properties.forEach(function(prop, i) {
DEFPRINT(AST_Object, function(output) {
var props = this.properties;
if (props.length > 0) output.with_block(function() {
props.forEach(function(prop, i) {
if (i) {

@@ -1339,3 +1323,3 @@ output.print(",");

});
else print_braced_empty(self, output);
else print_braced_empty(this, output);
});

@@ -1359,3 +1343,4 @@

DEFPRINT(AST_ObjectKeyVal, function(self, output) {
DEFPRINT(AST_ObjectKeyVal, function(output) {
var self = this;
print_property_name(self.key, self.quote, output);

@@ -1365,38 +1350,38 @@ output.colon();

});
AST_ObjectProperty.DEFMETHOD("_print_getter_setter", function(type, output) {
output.print(type);
output.space();
print_property_name(this.key.name, this.quote, output);
this.value._do_print(output, true);
function print_accessor(type) {
return function(output) {
var self = this;
output.print(type);
output.space();
print_property_name(self.key.name, self.quote, output);
self.value._codegen(output, true);
};
}
DEFPRINT(AST_ObjectGetter, print_accessor("get"));
DEFPRINT(AST_ObjectSetter, print_accessor("set"));
DEFPRINT(AST_Symbol, function(output) {
var def = this.definition();
output.print_name(def && def.mangled_name || this.name);
});
DEFPRINT(AST_ObjectSetter, function(self, output) {
self._print_getter_setter("set", output);
});
DEFPRINT(AST_ObjectGetter, function(self, output) {
self._print_getter_setter("get", output);
});
DEFPRINT(AST_Symbol, function(self, output) {
var def = self.definition();
output.print_name(def && def.mangled_name || self.name);
});
DEFPRINT(AST_Hole, noop);
DEFPRINT(AST_This, function(self, output) {
DEFPRINT(AST_This, function(output) {
output.print("this");
});
DEFPRINT(AST_Constant, function(self, output) {
output.print(self.value);
DEFPRINT(AST_Constant, function(output) {
output.print(this.value);
});
DEFPRINT(AST_String, function(self, output) {
output.print_string(self.value, self.quote);
DEFPRINT(AST_String, function(output) {
output.print_string(this.value, this.quote);
});
DEFPRINT(AST_Number, function(self, output) {
if (use_asm && self.start && self.start.raw != null) {
output.print(self.start.raw);
DEFPRINT(AST_Number, function(output) {
var start = this.start;
if (use_asm && start && start.raw != null) {
output.print(start.raw);
} else {
output.print(make_num(self.value));
output.print(make_num(this.value));
}
});
DEFPRINT(AST_RegExp, function(self, output) {
var regexp = self.value;
DEFPRINT(AST_RegExp, function(output) {
var regexp = this.value;
var str = regexp.toString();

@@ -1435,3 +1420,3 @@ var end = str.lastIndexOf("/");

var p = output.parent();
if (p instanceof AST_Binary && /^in/.test(p.operator) && p.left === self)
if (p instanceof AST_Binary && /^in/.test(p.operator) && p.left === this)
output.print(" ");

@@ -1438,0 +1423,0 @@ });

@@ -113,3 +113,2 @@ /***********************************************************************

keep_quoted: false,
only_cache: false,
regex: null,

@@ -217,3 +216,2 @@ reserved: null,

if (unmangleable[name]) return false;
if (options.only_cache) return cache.has(name);
if (/^-?[0-9]+(\.[0-9]+)?(e[+-][0-9]+)?$/.test(name)) return false;

@@ -220,0 +218,0 @@ return true;

@@ -99,4 +99,5 @@ /***********************************************************************

var self = this;
var defun = null;
var next_def_id = 0;
var scope = self.parent_scope = null;
var defun = null;
var tw = new TreeWalker(function(node, descend) {

@@ -153,3 +154,5 @@ if (node instanceof AST_Catch) {

});
self.next_def_id = 0;
self.make_def = function(orig, init) {
return new SymbolDef(++next_def_id, this, orig, init);
};
self.walk(tw);

@@ -245,8 +248,2 @@

AST_Scope.DEFMETHOD("make_def", function(orig, init) {
var top = this;
while (top.parent_scope) top = top.parent_scope;
return new SymbolDef(++top.next_def_id, this, orig, init);
});
AST_Toplevel.DEFMETHOD("def_global", function(node) {

@@ -265,14 +262,19 @@ var globals = this.globals, name = node.name;

function init_scope_vars(scope, parent) {
scope.cname = -1; // the current index for mangling functions/variables
scope.enclosed = []; // variables from this or outer scope(s) that are referenced from this or inner scopes
scope.uses_eval = false; // will be set to true if this or nested scope uses the global `eval`
scope.uses_with = false; // will be set to true if this or some nested scope uses the `with` statement
scope.parent_scope = parent; // the parent scope (null if this is the top level)
scope.functions = new Dictionary(); // map name to AST_SymbolDefun (functions defined in this scope)
scope.variables = new Dictionary(); // map name to AST_SymbolVar (variables defined in this scope; includes functions)
if (parent) scope.make_def = parent.make_def; // top-level tracking of SymbolDef instances
}
AST_Scope.DEFMETHOD("init_scope_vars", function(parent_scope) {
this.variables = new Dictionary(); // map name to AST_SymbolVar (variables defined in this scope; includes functions)
this.functions = new Dictionary(); // map name to AST_SymbolDefun (functions defined in this scope)
this.uses_with = false; // will be set to true if this or some nested scope uses the `with` statement
this.uses_eval = false; // will be set to true if this or nested scope uses the global `eval`
this.parent_scope = parent_scope; // the parent scope
this.enclosed = []; // a list of variables from this or outer scope(s) that are referenced from this or inner scopes
this.cname = -1; // the current index for mangling functions/variables
init_scope_vars(this, parent_scope);
});
AST_Lambda.DEFMETHOD("init_scope_vars", function() {
AST_Scope.prototype.init_scope_vars.apply(this, arguments);
AST_Lambda.DEFMETHOD("init_scope_vars", function(parent_scope) {
init_scope_vars(this, parent_scope);
this.uses_arguments = false;

@@ -282,3 +284,3 @@ this.def_variable(new AST_SymbolFunarg({

start: this.start,
end: this.end
end: this.end,
}));

@@ -395,6 +397,2 @@ });

AST_Symbol.DEFMETHOD("unreferenced", function() {
return !this.definition().references.length && !this.scope.pinned();
});
AST_Symbol.DEFMETHOD("definition", function() {

@@ -404,6 +402,2 @@ return this.thedef;

AST_Symbol.DEFMETHOD("global", function() {
return this.definition().global;
});
function _default_mangler_options(options) {

@@ -568,4 +562,4 @@ options = defaults(options, {

base54.reset();
var fn = AST_Symbol.prototype.add_source_map;
try {
var fn = AST_Symbol.prototype.add_source_map;
AST_Symbol.prototype.add_source_map = function() {

@@ -572,0 +566,0 @@ if (!this.unmangleable(options)) base54.consider(this.name, -1);

@@ -115,47 +115,25 @@ /***********************************************************************

var List = (function() {
function List(a, f, backwards) {
var ret = [], top = [], i;
function doit() {
function List(a, f) {
var ret = [];
for (var i = 0; i < a.length; i++) {
var val = f(a[i], i);
var is_last = val instanceof Last;
if (is_last) val = val.v;
if (val instanceof AtTop) {
val = val.v;
if (val instanceof Splice) {
top.push.apply(top, backwards ? val.v.slice().reverse() : val.v);
} else {
top.push(val);
}
} else if (val !== skip) {
if (val instanceof Splice) {
ret.push.apply(ret, backwards ? val.v.slice().reverse() : val.v);
} else {
ret.push(val);
}
}
return is_last;
}
if (Array.isArray(a)) {
if (backwards) {
for (i = a.length; --i >= 0;) if (doit()) break;
ret.reverse();
top.reverse();
if (val === skip) continue;
if (val instanceof Splice) {
ret.push.apply(ret, val.v);
} else {
for (i = 0; i < a.length; ++i) if (doit()) break;
ret.push(val);
}
} else {
for (i in a) if (HOP(a, i)) if (doit()) break;
}
return top.concat(ret);
return ret;
}
List.is_op = function(val) {
return val === skip || val instanceof AtTop || val instanceof Last || val instanceof Splice;
return val === skip || val instanceof Splice;
};
List.at_top = function(val) { return new AtTop(val); };
List.splice = function(val) { return new Splice(val); };
List.last = function(val) { return new Last(val); };
List.splice = function(val) {
return new Splice(val);
};
var skip = List.skip = {};
function AtTop(val) { this.v = val; }
function Splice(val) { this.v = val; }
function Last(val) { this.v = val; }
function Splice(val) {
this.v = val;
}
return List;

@@ -162,0 +140,0 @@ })();

@@ -6,3 +6,3 @@ {

"license": "BSD-2-Clause",
"version": "3.10.2",
"version": "3.10.3",
"engines": {

@@ -9,0 +9,0 @@ "node": ">=0.8.0"

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc