好用的工具推荐一下js美化代码

官网:https://beautifier.io/
尝试layui内置echarts,各种百度,由于本人功底太低,一直搞不定。于是尝试分析了一下压缩代码
echarts.min.js
尝试很多工具只有这一个比较好用,就是有点小慢
在这里插入图片描述
原来是这个样子的,没办法找到插入代码的地方

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.echarts={})}(this,function(t){"use strict";function e(t){var e={},i={},n=t.match(/Firefox\/([\d.]+)/),r=t.match(/MSIE\s([\d.]+)/)||t.match(/Trident\/.+?rv:(([\d.]+))/),a=t.match(/Edge\/([\d.]+)/),o=/micromessenger/i.test(t);return n&&(i.firefox=!0,i.version=n[1]),r&&(i.ie=!0,i.version=r[1]),a&&(i.edge=!0,i.version=a[1]),o&&(i.weChat=!0),{browser:i,os:e,node:!1,canvasSupported:!!document.createElement("canvas").getContext,svgSupported:"undefined"!=typeof SVGRect,touchEventsSupported:"ontouchstart"in window&&!i.ie&&!i.edge,pointerEventsSupported:"onpointerdown"in window&&(i.edge||i.ie&&i.version>=11)}}function i(t,e){"createCanvas"===t&&(Yd=null),Xd[t]=e}function n(t){if(null==t||"object"!=typeof t)return t;var e=t,i=Fd.call(t);if("[object Array]"===i){if(!B(t)){e=[];for(var r=0,a=t.length;a>r;r++)e[r]=n(t[r])}}else if(Nd[i]){if(!B(t)){var o=t.constructor;if(t.constructor.from)e=o.from(t);else{e=new o(t.length);for(var r=0,a=t.length;a>r;r++)e[r]=n(t[r])}}}else if(!Rd[i]&&!B(t)&&!T(t)){e={};for(var s in t)t.hasOwnProperty(s)&&(e[s]=n(t[s]))}return e}function r(t,e,i){if(!S(e)||!S(t))return i?n

美化后

! function(t, e) {
    "object" == typeof exports && "undefined" != typeof module ? e(exports) : "function" == typeof define && define.amd ? define(["exports"], e) : e(t.echarts = {})
}(this, function(t) {
        "use strict";

        function e(t) {
            var e = {},
                i = {},
                n = t.match(/Firefox\/([\d.]+)/),
                r = t.match(/MSIE\s([\d.]+)/) || t.match(/Trident\/.+?rv:(([\d.]+))/),
                a = t.match(/Edge\/([\d.]+)/),
                o = /micromessenger/i.test(t);
            return n && (i.firefox = !0, i.version = n[1]), r && (i.ie = !0, i.version = r[1]), a && (i.edge = !0, i.version = a[1]), o && (i.weChat = !0), {
                browser: i,
                os: e,
                node: !1,
                canvasSupported: !!document.createElement("canvas").getContext,
                svgSupported: "undefined" != typeof SVGRect,
                touchEventsSupported: "ontouchstart" in window && !i.ie && !i.edge,
                pointerEventsSupported: "onpointerdown" in window && (i.edge || i.ie && i.version >= 11)
            }

是不是清楚的多了。

猜你喜欢

转载自blog.csdn.net/taogunet/article/details/111241753
今日推荐