opennms
Version:
Client API for the OpenNMS network monitoring platform
1 lines • 2.98 kB
JSON
{"remainingRequest":"/data/node_modules/babel-loader/lib/index.js!/data/node_modules/string-width/index.js","dependencies":[{"path":"/data/node_modules/string-width/index.js","mtime":1553611386812},{"path":"/data/.babelrc","mtime":1553611371556},{"path":"/data/node_modules/cache-loader/dist/cjs.js","mtime":1553611387012},{"path":"/data/node_modules/babel-loader/lib/index.js","mtime":1553611386992}],"contextDependencies":[],"result":["'use strict';\n\nvar stripAnsi = require('strip-ansi');\nvar codePointAt = require('code-point-at');\nvar isFullwidthCodePoint = require('is-fullwidth-code-point');\n\n// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1345\nmodule.exports = function (str) {\n\tif (typeof str !== 'string' || str.length === 0) {\n\t\treturn 0;\n\t}\n\n\tvar width = 0;\n\n\tstr = stripAnsi(str);\n\n\tfor (var i = 0; i < str.length; i++) {\n\t\tvar code = codePointAt(str, i);\n\n\t\t// ignore control characters\n\t\tif (code <= 0x1f || code >= 0x7f && code <= 0x9f) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// surrogates\n\t\tif (code >= 0x10000) {\n\t\t\ti++;\n\t\t}\n\n\t\tif (isFullwidthCodePoint(code)) {\n\t\t\twidth += 2;\n\t\t} else {\n\t\t\twidth++;\n\t\t}\n\t}\n\n\treturn width;\n};",{"version":3,"sources":["node_modules/string-width/index.js"],"names":["stripAnsi","require","codePointAt","isFullwidthCodePoint","module","exports","str","length","width","i","code"],"mappings":"AAAA;;AACA,IAAIA,YAAYC,QAAQ,YAAR,CAAhB;AACA,IAAIC,cAAcD,QAAQ,eAAR,CAAlB;AACA,IAAIE,uBAAuBF,QAAQ,yBAAR,CAA3B;;AAEA;AACAG,OAAOC,OAAP,GAAiB,UAAUC,GAAV,EAAe;AAC/B,KAAI,OAAOA,GAAP,KAAe,QAAf,IAA2BA,IAAIC,MAAJ,KAAe,CAA9C,EAAiD;AAChD,SAAO,CAAP;AACA;;AAED,KAAIC,QAAQ,CAAZ;;AAEAF,OAAMN,UAAUM,GAAV,CAAN;;AAEA,MAAK,IAAIG,IAAI,CAAb,EAAgBA,IAAIH,IAAIC,MAAxB,EAAgCE,GAAhC,EAAqC;AACpC,MAAIC,OAAOR,YAAYI,GAAZ,EAAiBG,CAAjB,CAAX;;AAEA;AACA,MAAIC,QAAQ,IAAR,IAAiBA,QAAQ,IAAR,IAAgBA,QAAQ,IAA7C,EAAoD;AACnD;AACA;;AAED;AACA,MAAIA,QAAQ,OAAZ,EAAqB;AACpBD;AACA;;AAED,MAAIN,qBAAqBO,IAArB,CAAJ,EAAgC;AAC/BF,YAAS,CAAT;AACA,GAFD,MAEO;AACNA;AACA;AACD;;AAED,QAAOA,KAAP;AACA,CA9BD","file":"index.js","sourceRoot":"/data","sourcesContent":["'use strict';\nvar stripAnsi = require('strip-ansi');\nvar codePointAt = require('code-point-at');\nvar isFullwidthCodePoint = require('is-fullwidth-code-point');\n\n// https://github.com/nodejs/io.js/blob/cff7300a578be1b10001f2d967aaedc88aee6402/lib/readline.js#L1345\nmodule.exports = function (str) {\n\tif (typeof str !== 'string' || str.length === 0) {\n\t\treturn 0;\n\t}\n\n\tvar width = 0;\n\n\tstr = stripAnsi(str);\n\n\tfor (var i = 0; i < str.length; i++) {\n\t\tvar code = codePointAt(str, i);\n\n\t\t// ignore control characters\n\t\tif (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\t// surrogates\n\t\tif (code >= 0x10000) {\n\t\t\ti++;\n\t\t}\n\n\t\tif (isFullwidthCodePoint(code)) {\n\t\t\twidth += 2;\n\t\t} else {\n\t\t\twidth++;\n\t\t}\n\t}\n\n\treturn width;\n};\n"]}]}