Skip to content

Commit

Permalink
lint: use standard style
Browse files Browse the repository at this point in the history
  • Loading branch information
dougwilson committed Mar 3, 2017
1 parent 8c9b6b0 commit 625a0aa
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
@@ -0,0 +1,2 @@
coverage
node_modules
3 changes: 3 additions & 0 deletions .eslintrc
@@ -0,0 +1,3 @@
{
"extends": "standard"
}
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -19,6 +19,7 @@ before_install:
- "test $TRAVIS_NODE_VERSION != '0.8' || npm install -g npm@1.2.8000"
# Setup Node.js version-specific dependencies
- "test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul"
- "test $(echo $TRAVIS_NODE_VERSION | cut -d. -f1) -ge 4 || npm rm --save-dev eslint eslint-config-standard eslint-plugin-promise eslint-plugin-standard"
# Update Node.js modules
- "test ! -d node_modules || npm prune"
- "test ! -d node_modules || npm rebuild"
Expand Down
6 changes: 3 additions & 3 deletions index.js
Expand Up @@ -28,7 +28,7 @@ module.exports = destroy
* @public
*/

function destroy(stream) {
function destroy (stream) {
if (stream instanceof ReadStream) {
return destroyReadStream(stream)
}
Expand All @@ -51,7 +51,7 @@ function destroy(stream) {
* @private
*/

function destroyReadStream(stream) {
function destroyReadStream (stream) {
stream.destroy()

if (typeof stream.close === 'function') {
Expand All @@ -67,7 +67,7 @@ function destroyReadStream(stream) {
* @private
*/

function onOpenClose() {
function onOpenClose () {
if (typeof this.fd === 'number') {
// actually close down the fd
this.close()
Expand Down
5 changes: 5 additions & 0 deletions package.json
Expand Up @@ -14,6 +14,10 @@
"license": "MIT",
"repository": "stream-utils/destroy",
"devDependencies": {
"eslint": "3.16.1",
"eslint-config-standard": "7.0.0",
"eslint-plugin-promise": "3.5.0",
"eslint-plugin-standard": "2.1.1",
"istanbul": "0.4.5",
"mocha": "2.5.3"
},
Expand All @@ -22,6 +26,7 @@
"npm": "1.2.8000 || >= 1.4.16"
},
"scripts": {
"lint": "eslint .",
"test": "mocha --reporter spec",
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot",
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"
Expand Down
5 changes: 5 additions & 0 deletions test/.eslintrc
@@ -0,0 +1,5 @@
{
"env": {
"mocha": true
}
}
8 changes: 4 additions & 4 deletions test/test.js
Expand Up @@ -28,18 +28,18 @@ describe('destroy', function () {
var _open = fs.open
var waitclose = false

function cleanup() {
function cleanup () {
fs.close = _close
fs.open = _open
}

fs.close = function close() {
fs.close = function close () {
_close.apply(this, arguments)
cleanup()
done()
}

fs.open = function open() {
fs.open = function open () {
waitclose = true
_open.apply(this, arguments)
}
Expand Down Expand Up @@ -74,7 +74,7 @@ describe('destroy', function () {
})
})

function isdestroyed(stream) {
function isdestroyed (stream) {
// readable for 0.8, destroyed for 0.10+
return stream.readable === false || stream.destroyed === true
}

0 comments on commit 625a0aa

Please sign in to comment.