UNPKG

word-table

Version:

word-table is simple browserjs / nodejs library for drawing tables in the terminal/console.

1 lines 10.2 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("WordTable",[],e):"object"==typeof exports?exports.WordTable=e():t.WordTable=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=2)}([function(t,e,n){"use strict";(function(t){var n,r,o,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};!function(a,l){"object"==i(e)&&"object"==i(t)?t.exports=l():(r=[],n=l,void 0!==(o="function"==typeof n?n.apply(e,r):n)&&(t.exports=o))}(0,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=2)}([function(t,e,n){t.exports=[[4352,4447],[8986,8987],[9001,9002],[9193,9196],[9200,9200],[9203,9203],[9725,9726],[9748,9749],[9800,9811],[9855,9855],[9875,9875],[9889,9889],[9898,9899],[9917,9918],[9924,9925],[9934,9934],[9940,9940],[9962,9962],[9970,9971],[9973,9973],[9978,9978],[9981,9981],[9989,9989],[9994,9995],[10024,10024],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10133,10135],[10160,10160],[10175,10175],[11035,11036],[11088,11088],[11093,11093],[11904,11929],[11931,12019],[12032,12245],[12272,12283],[12288,12350],[12353,12438],[12441,12543],[12549,12589],[12593,12686],[12688,12730],[12736,12771],[12784,12830],[12832,12871],[12880,13054],[13056,19903],[19968,42124],[42128,42182],[43360,43388],[44032,55203],[63744,64255],[65040,65049],[65072,65106],[65108,65126],[65128,65131],[65281,65376],[65504,65510],[94176,94176],[94208,100332],[100352,101106],[110592,110593],[126980,126980],[127183,127183],[127374,127374],[127377,127386],[127488,127490],[127504,127547],[127552,127560],[127568,127569],[127744,127776],[127789,127797],[127799,127868],[127870,127891],[127904,127946],[127951,127955],[127968,127984],[127988,127988],[127992,128062],[128064,128064],[128066,128252],[128255,128317],[128331,128334],[128336,128359],[128378,128378],[128405,128406],[128420,128420],[128507,128591],[128640,128709],[128716,128716],[128720,128722],[128747,128748],[128756,128758],[129296,129310],[129312,129319],[129328,129328],[129331,129342],[129344,129355],[129360,129374],[129408,129425],[129472,129472],[131072,196605],[196608,262141]]},function(t,e,n){t.exports=[[768,879],[1155,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1552,1562],[1611,1631],[1648,1648],[1750,1756],[1759,1764],[1767,1768],[1770,1773],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2260,2273],[2275,2306],[2362,2362],[2364,2364],[2369,2376],[2381,2381],[2385,2391],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2641,2641],[2672,2673],[2677,2677],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2884],[2893,2893],[2902,2902],[2914,2915],[2946,2946],[3008,3008],[3021,3021],[3072,3072],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],[3201,3201],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3329,3329],[3393,3396],[3405,3405],[3426,3427],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],[4226,4226],[4229,4230],[4237,4237],[4253,4253],[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6277,6278],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6683,6683],[6742,6742],[6744,6750],[6752,6752],[6754,6754],[6757,6764],[6771,6780],[6783,6783],[6832,6846],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],[7142,7142],[7144,7145],[7149,7149],[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],[7405,7405],[7412,7412],[7416,7417],[7616,7669],[7675,7679],[8400,8432],[11503,11505],[11647,11647],[11744,11775],[12330,12333],[12441,12442],[42607,42610],[42612,42621],[42654,42655],[42736,42737],[43010,43010],[43014,43014],[43019,43019],[43045,43046],[43204,43205],[43232,43249],[43302,43309],[43335,43345],[43392,43394],[43443,43443],[43446,43449],[43452,43452],[43493,43493],[43561,43566],[43569,43570],[43573,43574],[43587,43587],[43596,43596],[43644,43644],[43696,43696],[43698,43700],[43703,43704],[43710,43711],[43713,43713],[43756,43757],[43766,43766],[44005,44005],[44008,44008],[44013,44013],[64286,64286],[65024,65039],[65056,65071],[66045,66045],[66272,66272],[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[68325,68326],[69633,69633],[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69888,69890],[69927,69931],[69933,69940],[70003,70003],[70016,70017],[70070,70078],[70090,70092],[70191,70193],[70196,70196],[70198,70199],[70206,70206],[70367,70367],[70371,70378],[70400,70401],[70460,70460],[70464,70464],[70502,70508],[70512,70516],[70712,70719],[70722,70724],[70726,70726],[70835,70840],[70842,70842],[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],[71229,71229],[71231,71232],[71339,71339],[71341,71341],[71344,71349],[71351,71351],[71453,71455],[71458,71461],[71463,71467],[72752,72758],[72760,72765],[72767,72767],[72850,72871],[72874,72880],[72882,72883],[72885,72886],[92912,92916],[92976,92982],[94095,94098],[113821,113822],[119143,119145],[119163,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],[121461,121461],[121476,121476],[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[125136,125142],[125252,125258],[917760,917999]]},function(t,e,n){var r=n(1),o=n(0),i=function(t,e){var n=0,r=e.length-1,o=void 0;if(t<e[0][0]||t>e[r][1])return 0;for(;r>=n;)if(o=parseInt((n+r)/2,10),t>e[o][1])n=o+1;else{if(!(t<e[o][0]))return 1;r=o-1}return 0},a=function(t){return 0===t||847===t||t>=8203&&t<=8207||8232===t||8233===t||t>=8234&&t<=8238||t>=8288&&t<=8291?0:t<32||t>=127&&t<160?-1:i(t,r)?0:1+i(t,o)};t.exports=function(t){for(var e=0,n=t.length,r=0;e<n;e+=1)r+=a(t.charCodeAt(e));return r}}])})}).call(e,n(1)(t))},function(t,e,n){"use strict";t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var o=n(0),i=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];r(this,t),a.call(this),this._updated=!0,this._stringTable=null,this._tableColLength=0,this._maxCols=0,this._tableDatas=null,this._wordWidthMap=[],this._tableHeader=e,this._tableBody=n},a=function(){var t=this;this._fillStr=function(t,e){var n="",r=void 0;for(r=0;r<t;r+=1)n+=e;return n},this._initLength=function(e,n,r){t._maxCols=Math.max(n+1,t._maxCols),t._tableColLength.length<=n&&t._tableColLength.push(0);for(var i=o(""+r);t._wordWidthMap.length<=e;)t._wordWidthMap.push([]);t._wordWidthMap[e].length<=n?t._wordWidthMap[e].push(i):t._wordWidthMap[e][n]=i,t._tableColLength[n]=Math.max(i,t._tableColLength[n])},this._initDatas=function(){t._tableDatas=t._tableBody.concat(),t._tableDatas.splice(0,0,t._tableHeader),t._tableColLength=[],t._maxCols=0;var e=void 0,n=void 0,r=t._tableDatas.length,o=void 0,i=void 0;for(e=0;e<r;e+=1)for(o=t._tableDatas[e],i=o.length,n=0;n<i;n+=1)t._initLength(e,n,o[n])},this._drawDivider=function(e){var n=void 0,r=void 0,o="+";for(n=0;n<t._maxCols;n+=1)r=t._tableColLength[n]+2*e[n],o+=t._fillStr(r,"-"),o+="+";return o},this._drawLine=function(e,n,r){var o=void 0,i="|",a=e.length,l=void 0,u=void 0,f=void 0;for(o=0;o<t._maxCols;o+=1)o>=a?(i+=t._fillStr(t._tableColLength[o]+2*n[o]," "),i+="|"):(l=(t._tableColLength[o]-t._wordWidthMap[r][o])/2,u=Math.floor(l),f=Math.ceil(l),i+=t._fillStr(n[o]+u," "),i+=e[o],i+=t._fillStr(n[o]+f," "),i+="|");return i},this._drawTable=function(){var e=void 0,n=[],r=t._tableDatas.length;for(e=0;e<t._maxCols;e+=1)n.push(Math.ceil(t._tableColLength[e]/4));var o=t._drawDivider(n);for(t._stringTable=[o],e=0;e<r;e+=1)t._stringTable.push(t._drawLine(t._tableDatas[e],n,e)),t._stringTable.push(o)},this.string=function(){return t.array().join("\n")},this.array=function(){if(t._updated){if(t._initDatas(),t._drawTable(),0===t._maxCols)return[];t._updated=!1}return t._stringTable},this.setHeader=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return t._tableHeader=e,t._updated=!0,t},this.appendBody=function(e){return t._tableBody.push(e),t._updated=!0,t},this.setBody=function(e){return t._tableBody=e,t._updated=!0,t},this.reset=function(){return t._updated=!0,t._tableHeader=[],t._tableBody=[],t}};t.exports=i}])});