window-size
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -12,3 +12,3 @@ #!/usr/bin/env node | ||
function showSize() { | ||
function showSize () { | ||
var size = require('./'); | ||
@@ -25,3 +25,3 @@ console.log('height: ' + size.height); | ||
console.log(helpText); | ||
break; | ||
break; | ||
default: | ||
@@ -28,0 +28,0 @@ showSize(); |
14
index.js
@@ -0,1 +1,3 @@ | ||
'use strict'; | ||
/*! | ||
@@ -8,10 +10,10 @@ * window-size <https://github.com/jonschlinkert/window-size> | ||
const tty = require('tty'); | ||
var tty = require('tty'); | ||
module.exports = (function() { | ||
module.exports = (function () { | ||
var width; | ||
var height; | ||
if(tty.isatty(1) && tty.isatty(2)) { | ||
if(process.stdout.getWindowSize) { | ||
if (tty.isatty(1) && tty.isatty(2)) { | ||
if (process.stdout.getWindowSize) { | ||
width = process.stdout.getWindowSize(1)[0]; | ||
@@ -27,6 +29,6 @@ height = process.stdout.getWindowSize(1)[1]; | ||
} else { | ||
new Error('window-size could not get size with tty or process.stdout.'); | ||
Error('window-size could not get size with tty or process.stdout.'); | ||
} | ||
return {height: height, width: width}; | ||
})(); | ||
})(); |
{ | ||
"name": "window-size", | ||
"description": "Reliable way to to get the height and width of the terminal/console in a node.js environment.", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"homepage": "https://github.com/jonschlinkert/window-size", | ||
@@ -10,2 +10,6 @@ "author": { | ||
}, | ||
"scripts": { | ||
"pretest": "semistandard", | ||
"test": "tap --coverage test.js" | ||
}, | ||
"repository": { | ||
@@ -37,3 +41,7 @@ "type": "git", | ||
"window" | ||
] | ||
], | ||
"devDependencies": { | ||
"semistandard": "^7.0.2", | ||
"tap": "^2.2.1" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# window-size [![NPM version](https://badge.fury.io/js/window-size.svg)](http://badge.fury.io/js/window-size) | ||
# window-size [![NPM version](https://badge.fury.io/js/window-size.svg)](http://badge.fury.io/js/window-size) [![Build Status](https://travis-ci.org/jonschlinkert/window-size.svg)](https://travis-ci.org/jonschlinkert/window-size) | ||
@@ -21,21 +21,11 @@ > Reliable way to to get the height and width of the terminal/console in a node.js environment. | ||
## CLI | ||
```shell | ||
$ window-size | ||
height: 40 | ||
width : 145 | ||
``` | ||
## Other projects | ||
* [assemble](http://assemble.io): Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… [more](http://assemble.io) | ||
* [micromatch](https://github.com/jonschlinkert/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. Just… [more](https://github.com/jonschlinkert/micromatch) | ||
* [remarkable](https://github.com/jonschlinkert/remarkable): Markdown parser, done right. 100% Commonmark support, extensions, syntax plugins, high speed - all in… [more](https://github.com/jonschlinkert/remarkable) | ||
* [snapdragon](https://github.com/jonschlinkert/snapdragon): snapdragon is an extremely pluggable, powerful and easy-to-use parser-renderer factory. | ||
* [verb](https://github.com/assemble/verb): Documentation generator for GitHub projects. Extremely powerful, easy to use, can generate anything from API… [more](https://github.com/assemble/verb) | ||
* [base-cli](https://www.npmjs.com/package/base-cli): Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a… [more](https://www.npmjs.com/package/base-cli) | [homepage](https://github.com/jonschlinkert/base-cli) | ||
* [lint-deps](https://www.npmjs.com/package/lint-deps): CLI tool that tells you when dependencies are missing from package.json and offers you a… [more](https://www.npmjs.com/package/lint-deps) | [homepage](https://github.com/jonschlinkert/lint-deps) | ||
* [yargs](https://www.npmjs.com/package/yargs): Light-weight option parsing with an argv hash. No optstrings attached. | [homepage](https://github.com/bcoe/yargs#readme) | ||
## Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/window-size/issues/new) | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/window-size/issues/new). | ||
@@ -56,2 +46,2 @@ ## Author | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 07, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 15, 2015._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55
5133
2
45