stream.finished
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -1,3 +0,3 @@ | ||
import shim = require("./shim"); | ||
import shim = require('./shim'); | ||
export {}; |
# Changelog | ||
## v1.1.2 2019-05-08 | ||
* Updated dependencies. | ||
## v1.1.1 2018-09-18 | ||
@@ -4,0 +8,0 @@ |
@@ -7,11 +7,11 @@ 'use strict'; | ||
function noop () { } | ||
function noop() {} | ||
function isRequest (stream) { | ||
function isRequest(stream) { | ||
return stream.setHeader && typeof stream.abort === 'function'; | ||
} | ||
function once (callback) { | ||
function once(callback) { | ||
var called = false; | ||
return function (err) { | ||
return function(err) { | ||
if (called) return; | ||
@@ -23,3 +23,3 @@ called = true; | ||
function eos (stream, opts, callback) { | ||
function eos(stream, opts, callback) { | ||
if (typeof opts === 'function') return eos(stream, null, opts); | ||
@@ -35,7 +35,7 @@ if (!opts) opts = {}; | ||
var onlegacyfinish = function () { | ||
var onlegacyfinish = function() { | ||
if (!stream.writable) onfinish(); | ||
}; | ||
var onfinish = function () { | ||
var onfinish = function() { | ||
writable = false; | ||
@@ -45,3 +45,3 @@ if (!readable) callback.call(stream); | ||
var onend = function () { | ||
var onend = function() { | ||
readable = false; | ||
@@ -51,7 +51,7 @@ if (!writable) callback.call(stream); | ||
var onerror = function (err) { | ||
var onerror = function(err) { | ||
callback.call(stream, err); | ||
}; | ||
var onclose = function () { | ||
var onclose = function() { | ||
if (readable && !(rs && rs.ended)) { | ||
@@ -71,3 +71,3 @@ var rerror = new Error('Premature close'); | ||
var onrequest = function () { | ||
var onrequest = function() { | ||
stream.req.on('finish', onfinish); | ||
@@ -81,3 +81,4 @@ }; | ||
else stream.on('request', onrequest); | ||
} else if (writable && !ws) { // legacy streams | ||
} else if (writable && !ws) { | ||
// legacy streams | ||
stream.on('end', onlegacyfinish); | ||
@@ -92,3 +93,3 @@ stream.on('close', onlegacyfinish); | ||
return function () { | ||
return function() { | ||
stream.removeListener('complete', onfinish); | ||
@@ -95,0 +96,0 @@ stream.removeListener('abort', onclose); |
/// <reference types="node" /> | ||
import * as stream from "stream"; | ||
import * as stream from 'stream'; | ||
declare function finished(stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException) => void): () => void; | ||
declare function finished( | ||
stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, | ||
callback: (err?: NodeJS.ErrnoException) => void | ||
): () => void; | ||
@@ -7,0 +10,0 @@ declare namespace finished { |
@@ -12,4 +12,4 @@ 'use strict'; | ||
/* eslint-disable no-unused-vars */ | ||
var boundFinished = function finished (stream, opts, callback) { | ||
/* eslint-enable no-unused-vars */ | ||
var boundFinished = function finished(stream, opts, callback) { | ||
/* eslint-enable no-unused-vars */ | ||
return polyfill.apply(streamModule, arguments); | ||
@@ -16,0 +16,0 @@ }; |
{ | ||
"name": "stream.finished", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "Polyfill/shim for stream.finished in node versions < v10", | ||
@@ -29,13 +29,12 @@ "main": "index.js", | ||
"@es-shims/api": "^2.1.2", | ||
"@types/node": "^10.10.1", | ||
"eslint": "^5.6.0", | ||
"eslint-config-semistandard": "^12.0.1", | ||
"eslint-config-standard": "^12.0.0", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-node": "^7.0.1", | ||
"eslint-plugin-standard": "^4.0.0", | ||
"markdownlint-cli": "^0.13.0", | ||
"semistandard": "^12.0.1", | ||
"tslint": "^5.11.0", | ||
"typescript": "^3.0.3", | ||
"@types/node": "^12.0.0", | ||
"eslint": "^5.16.0", | ||
"eslint-config-prettier": "^4.2.0", | ||
"eslint-plugin-import": "^2.17.2", | ||
"eslint-plugin-node": "^9.0.1", | ||
"markdownlint-cli": "^0.15.0", | ||
"prettier": "^1.17.0", | ||
"tslint": "^5.16.0", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^3.4.5", | ||
"util.promisify": "^1.0.0" | ||
@@ -45,3 +44,3 @@ }, | ||
"postpublish": "git tag v$npm_package_version -a -m \"Release v$npm_package_version\" && git push --tags", | ||
"pretest": "eslint . && tsc --pretty -p . && tslint *.d.ts && markdownlint *.md && es-shim-api --bound", | ||
"pretest": "eslint . && tsc --pretty -p . && tslint *.d.ts && npx prettier --ignore-path .gitignore --list-different '**/*.ts' '**/*.js' '**/*.json' '**/*.yml' && markdownlint *.md && es-shim-api --bound", | ||
"test": "npm run test:spec", | ||
@@ -48,0 +47,0 @@ "test:spec": "node test" |
/// <reference types="node" /> | ||
import * as stream from "stream"; | ||
import * as stream from 'stream'; | ||
declare function getPolyfill(): (stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, callback: (err?: NodeJS.ErrnoException) => void) => () => void; | ||
declare function getPolyfill(): ( | ||
stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, | ||
callback: (err?: NodeJS.ErrnoException) => void | ||
) => () => void; | ||
export = getPolyfill; |
@@ -7,3 +7,3 @@ 'use strict'; | ||
module.exports = function getPolyfill () { | ||
module.exports = function getPolyfill() { | ||
if (typeof stream.finished === 'function') { | ||
@@ -10,0 +10,0 @@ return stream.finished; |
/// <reference types="node" /> | ||
import * as stream from "stream"; | ||
import getPolyfill = require("./polyfill"); | ||
import * as stream from 'stream'; | ||
import getPolyfill = require('./polyfill'); | ||
export = getPolyfill; |
@@ -9,7 +9,7 @@ 'use strict'; | ||
module.exports = function shimStreamFinished () { | ||
module.exports = function shimStreamFinished() { | ||
var polyfill = getPolyfill(); | ||
if (polyfill !== stream) { | ||
define(stream, { finished: polyfill }, { | ||
finished: function testFinished () { | ||
define(stream, {finished: polyfill}, { | ||
finished: function testFinished() { | ||
return stream.finished !== polyfill; | ||
@@ -16,0 +16,0 @@ } |
{ | ||
"compilerOptions": { | ||
"importHelpers": true, | ||
"lib": [ | ||
"es6" | ||
], | ||
"lib": ["es5"], | ||
"module": "commonjs", | ||
@@ -12,8 +9,6 @@ "noEmit": true, | ||
"noUnusedParameters": true, | ||
"target": "es6", | ||
"target": "es5", | ||
"strict": true, | ||
"typeRoots": [ | ||
"node_modules/@types" | ||
] | ||
"typeRoots": ["node_modules/@types"] | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
9583
12
165