'javascript decoding webpackJsonp to readable code

there is a way to change this code into a clear and readable code ?

(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{"2wwy":function(n,t,e){n.exports=e("nhzr")},E8gZ:function(n,t,e){var o=e("jmDH"),i=e("w6GO"),r=e("NsO/"),u=e("NV0k").f;n.exports=function(n){return function(t){for(var e,c=r(t),a=i(c),f=a.length,s=0,l=[];f>s;)e=a[s++],o&&!u.call(c,e)||l.push(n?[e,c[e]]:c[e]);return l}}},f0Zw:function(n,t,e){"use strict";e.r(t);var o=e("q1tI"),i=e.n(o),r=e("/MKj"),u=e("2wwy"),c=e.n(u),a=e("G4qV"),f=Object(a.a)((function(n){return n.g_notifications}),(function(n){return c()(n)})),s=e("F7NL"),l=e("kOwS"),p=e("qNsG"),v=e("CnBM"),w=e.n(v)()({loader:function(){return Promise.all([e.e(0),e.e(6)]).then(e.bind(null,"OyQA"))},loading:function(){return null},modules:["Notification"]}),b=i.a.createElement,d=function(n){var t=n.notifications,e=n.onRemove;return b(i.a.Fragment,null,t.map((function(n){var t=n.id,o=Object(p.a)(n,["id"]);return b(w,Object(l.a)({onRemove:e},o,{key:t,id:t}))})))},O=i.a.createElement,m=Object(r.b)((function(n){return{notifications:f(n)}})),j=function(n){var t=n.dataset.id;Object(s.b)(t)},g=m((function(n){var t=n.notifications;return O(d,{onRemove:j,notifications:t})}));t.default=g},fW1p:function(n,t,e){var o=e("Y7ZC"),i=e("E8gZ")(!1);o(o.S,"Object",{values:function(n){return i(n)}})},nhzr:function(n,t,e){e("fW1p"),n.exports=e("WEpk").Object.values}}]);


Solution 1:[1]

This looks like output from Webpack 4.

If the site you're looking at exposes source maps, you will see a section under sources in your browser's dev tools labelled "Webpack", which will contain the source for the scripts bundled using Webpack.

If the site doesn't expose source maps, the first step is to format the code. You can then start manually renaming variables as you figure out what they do. In this case, there must be more scripts on the site because there seem to be references to modules not defined in the file.

Passing this code through Prettier gives:

(window.webpackJsonp = window.webpackJsonp || []).push([
  [7],
  {
    "2wwy": function(n, t, e) {
      n.exports = e("nhzr");
    },
    E8gZ: function(n, t, e) {
      var o = e("jmDH"),
        i = e("w6GO"),
        r = e("NsO/"),
        u = e("NV0k").f;
      n.exports = function(n) {
        return function(t) {
          for (var e, c = r(t), a = i(c), f = a.length, s = 0, l = []; f > s; )
            (e = a[s++]), (o && !u.call(c, e)) || l.push(n ? [e, c[e]] : c[e]);
          return l;
        };
      };
    },
    f0Zw: function(n, t, e) {
      "use strict";
      e.r(t);
      var o = e("q1tI"),
        i = e.n(o),
        r = e("/MKj"),
        u = e("2wwy"),
        c = e.n(u),
        a = e("G4qV"),
        f = Object(a.a)(
          function(n) {
            return n.g_notifications;
          },
          function(n) {
            return c()(n);
          }
        ),
        s = e("F7NL"),
        l = e("kOwS"),
        p = e("qNsG"),
        v = e("CnBM"),
        w = e.n(v)()({
          loader: function() {
            return Promise.all([e.e(0), e.e(6)]).then(e.bind(null, "OyQA"));
          },
          loading: function() {
            return null;
          },
          modules: ["Notification"]
        }),
        b = i.a.createElement,
        d = function(n) {
          var t = n.notifications,
            e = n.onRemove;
          return b(
            i.a.Fragment,
            null,
            t.map(function(n) {
              var t = n.id,
                o = Object(p.a)(n, ["id"]);
              return b(w, Object(l.a)({ onRemove: e }, o, { key: t, id: t }));
            })
          );
        },
        O = i.a.createElement,
        m = Object(r.b)(function(n) {
          return { notifications: f(n) };
        }),
        j = function(n) {
          var t = n.dataset.id;
          Object(s.b)(t);
        },
        g = m(function(n) {
          var t = n.notifications;
          return O(d, { onRemove: j, notifications: t });
        });
      t.default = g;
    },
    fW1p: function(n, t, e) {
      var o = e("Y7ZC"),
        i = e("E8gZ")(!1);
      o(o.S, "Object", {
        values: function(n) {
          return i(n);
        }
      });
    },
    nhzr: function(n, t, e) {
      e("fW1p"), (n.exports = e("WEpk").Object.values);
    }
  }
]);

Solution 2:[2]

finding yourself in this is almost impossible, I mean that the result of decoding was on this principle:

var func = {
    init: function() {
        console.log('test');
        this.set();
    },
    set: function(){
        $('.body .test').innerHTML = 'test';
    }
}
func.init();

easy and legible

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Patrick Stephansen
Solution 2 Tabam