diff --git a/.editorconfig b/.editorconfig index b0d7fd9..86c8f59 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,3 @@ -# editorconfig.org root = true [*] @@ -8,5 +7,9 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true +[package.json] +indent_style = space +indent_size = 2 + [*.md] trim_trailing_whitespace = false diff --git a/.jshintrc b/.jshintrc index 39a8579..804f8af 100644 --- a/.jshintrc +++ b/.jshintrc @@ -4,16 +4,10 @@ "bitwise": true, "camelcase": true, "curly": true, - "eqeqeq": true, "immed": true, - "indent": 4, "newcap": true, "noarg": true, - "quotmark": "single", - "regexp": true, "undef": true, - "unused": true, - "strict": true, - "trailing": true, - "smarttabs": true + "unused": "vars", + "strict": true } diff --git a/index.js b/index.js index 49bae61..84527b6 100644 --- a/index.js +++ b/index.js @@ -2,7 +2,6 @@ module.exports = function (cb) { var ret = ''; - process.stdin.resume(); process.stdin.setEncoding('utf8'); process.stdin.on('data', function (data) { diff --git a/license b/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/package.json b/package.json index 91f9aec..467939b 100644 --- a/package.json +++ b/package.json @@ -13,19 +13,22 @@ "node": ">=0.10.0" }, "scripts": { - "test": "echo unicorns | mocha" + "test": "echo unicorns | node test.js" }, "files": [ "index.js" ], "keywords": [ + "std", "stdin", "stdio", "concat", "buffer", + "stream", + "process", "stream" ], "devDependencies": { - "mocha": "*" + "ava": "0.0.3" } } diff --git a/readme.md b/readme.md index 5a05e1e..7b76fee 100644 --- a/readme.md +++ b/readme.md @@ -5,7 +5,7 @@ ## Install -```bash +```sh $ npm install --save get-stdin ``` @@ -22,7 +22,7 @@ stdin(function (data) { }); ``` -```bash +```sh $ echo unicorns | node example.js unicorns ``` @@ -30,4 +30,4 @@ unicorns ## License -[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com) +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/test.js b/test.js index c2c8a21..bc383c9 100644 --- a/test.js +++ b/test.js @@ -1,10 +1,11 @@ 'use strict'; -var assert = require('assert'); -var stdin = require('./index'); +var test = require('ava'); +var stdin = require('./'); + +test('should get stdin', function (t) { + t.plan(1); -it('should get stdin', function (cb) { stdin(function (data) { - assert.equal(data.trim(), 'unicorns'); - cb(); + t.assert(data.trim() === 'unicorns'); }); });