Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / window-size / index.js
1 /*\r
2  * window-size\r
3  * https://github.com/jonschlinkert/window-size\r
4  *\r
5  * Copyright (c) 2014 Jon Schlinkert\r
6  * Licensed under the MIT license.\r
7  */\r
8 \r
9 const tty = require('tty')\r
10 \r
11 module.exports = (function() {\r
12   var width;\r
13   var height;\r
14 \r
15   if(tty.isatty(1) && tty.isatty(2)) {\r
16     if(process.stdout.getWindowSize) {\r
17       width = process.stdout.getWindowSize(1)[0];\r
18       height = process.stdout.getWindowSize(1)[1];\r
19     } else if (tty.getWindowSize) {\r
20       width = tty.getWindowSize()[1];\r
21       height = tty.getWindowSize()[0];\r
22     } else if (process.stdout.columns && process.stdout.rows) {\r
23       height = process.stdout.columns;\r
24       width = process.stdout.rows;\r
25     }\r
26   } else {\r
27     new Error('Error: could not get window size with tty or process.stdout');\r
28   }\r
29   return {\r
30     height: height,\r
31     width: width\r
32   }\r
33 })();