10000 If judgment condition has the scenario of assigning values to variables, short circuit logic should not be used to splice the executors in if judgment. · Issue #347 · tdewolff/minify · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
If judgment condition has the scenario of assigning values to variables, short circuit logic should not be used to splice the executors in if judgment. #347
Closed
@LiuJun0

Description

@LiuJun0

If judgment condition has the scenario of assigning values to variables, short circuit logic should not be used to splice the executors in if judgment.

Before compress

const r = [[Array(), Array()], [Array(), Array()]];

function test(e) {
    this.uid = 1;
    var n, o, a, c = {}, l = !0;
    if (-1 !== e.indexOf("::") ? function (t) {
        n = t[0], e = t[1]
    }(e.split("::")) : n = this.uid, e = e.toLowerCase(), o = r[n] && r[n][e]) {
        o.sort(function (e, t) {
            return t.priority - e.priority
        }), a = [].slice.call(arguments), a.shift(), c.type = e, a.unshift(c);
    }
    return [o, a, c, l];
}

console.log(test("1::1"));

After compress

const r=[[Array(),Array()],[Array(),Array()]];function test(e){this.uid=1;var n,o,a,c={},l=!0;return-1!==e.indexOf("::")?function(t){n=t[0],e=t[1]}(e.split("::")):n=this.uid,e=e.toLowerCase(),o=r[n]&&r[n][e]&&(o.sort(function(e,t){return t.priority-e.priority}),a=[].slice.call(arguments),a.shift(),c.type=e,a.unshift(c)),[o,a,c,l]}console.log(test("1::1"))
Uncaught TypeError: Cannot read property 'sort' of undefined
    at test (in.js:1)
    at in.js:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0