Comparing version 0.0.1 to 0.1.0
70
index.js
@@ -0,29 +1,61 @@ | ||
/*! | ||
* pause | ||
* Copyright(c) 2012 TJ Holowaychuk | ||
* Copyright(c) 2015 Douglas Christopher Wilson | ||
* MIT Licensed | ||
*/ | ||
module.exports = function(obj){ | ||
var onData | ||
, onEnd | ||
, events = []; | ||
'use strict' | ||
/** | ||
* Module exports. | ||
* @public | ||
*/ | ||
module.exports = pause | ||
/** | ||
* Pause the data events on a stream. | ||
* | ||
* @param {object} stream | ||
* @public | ||
*/ | ||
function pause(stream) { | ||
var events = [] | ||
var onData = createEventListener('data', events) | ||
var onEnd = createEventListener('end', events) | ||
// buffer data | ||
obj.on('data', onData = function(data, encoding){ | ||
events.push(['data', data, encoding]); | ||
}); | ||
stream.on('data', onData) | ||
// buffer end | ||
obj.on('end', onEnd = function(data, encoding){ | ||
events.push(['end', data, encoding]); | ||
}); | ||
stream.on('end', onEnd) | ||
return { | ||
end: function(){ | ||
obj.removeListener('data', onData); | ||
obj.removeListener('end', onEnd); | ||
end: function end() { | ||
stream.removeListener('data', onData) | ||
stream.removeListener('end', onEnd) | ||
}, | ||
resume: function(){ | ||
this.end(); | ||
for (var i = 0, len = events.length; i < len; ++i) { | ||
obj.emit.apply(obj, events[i]); | ||
resume: function resume() { | ||
this.end() | ||
for (var i = 0; i < events.length; i++) { | ||
stream.emit.apply(stream, events[i]) | ||
} | ||
} | ||
}; | ||
}; | ||
} | ||
} | ||
function createEventListener(name, events) { | ||
return function onEvent() { | ||
var args = new Array(arguments.length + 1) | ||
args[0] = name | ||
for (var i = 0; i < arguments.length; i++) { | ||
args[i + 1] = arguments[i] | ||
} | ||
events.push(args) | ||
} | ||
} |
{ | ||
"name": "pause", | ||
"version": "0.0.1", | ||
"description": "Pause streams...", | ||
"keywords": [], | ||
"description": "Pause a stream's data events", | ||
"version": "0.1.0", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca>", | ||
"dependencies": {}, | ||
"contributors": [ | ||
"Douglas Christopher Wilson <doug@somethingdoug.com>" | ||
], | ||
"license": "MIT", | ||
"repository": "stream-utils/pause", | ||
"devDependencies": { | ||
"mocha": "*", | ||
"should": "*" | ||
"after": "0.8.1", | ||
"istanbul": "0.3.17", | ||
"mocha": "1.21.5" | ||
}, | ||
"main": "index" | ||
} | ||
"files": [ | ||
"HISTORY.md", | ||
"LICENSE", | ||
"README.md", | ||
"index.js" | ||
], | ||
"engines": { | ||
"node": ">= 0.6" | ||
}, | ||
"scripts": { | ||
"test": "mocha --reporter spec --bail --check-leaks test/", | ||
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", | ||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" | ||
} | ||
} |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
4664
0
49
1
1
52
0
0
3
5
1