pull-stream
Advanced tools
Comparing version 3.4.2 to 3.4.3
{ | ||
"name": "pull-stream", | ||
"description": "minimal pull stream", | ||
"version": "3.4.2", | ||
"homepage": "https://github.com/dominictarr/pull-stream", | ||
"version": "3.4.3", | ||
"homepage": "https://pull-stream.github.io", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/dominictarr/pull-stream.git" | ||
"url": "git://github.com/pull-stream/pull-stream.git" | ||
}, | ||
@@ -10,0 +10,0 @@ "devDependencies": { |
@@ -71,9 +71,8 @@ # pull-stream | ||
```js | ||
//a stream of 100 random numbers. | ||
var i = 100 | ||
var random = function () { | ||
//a stream of random numbers. | ||
function random (n) { | ||
return function (end, cb) { | ||
if(end) return cb(end) | ||
//only read 100 times | ||
if(i-- < 0) return cb(true) | ||
//only read n times, then stop. | ||
if(0<--n) return cb(true) | ||
cb(null, Math.random()) | ||
@@ -96,3 +95,3 @@ } | ||
//read source and log it. | ||
var logger = function () { | ||
function logger () { | ||
return function (read) { | ||
@@ -113,3 +112,3 @@ read(null, function next(end, data) { | ||
```js | ||
var rand = random() | ||
var rand = random(100) | ||
var log = logger() | ||
@@ -137,3 +136,3 @@ | ||
```js | ||
var map = function (read, map) { | ||
function map (read, map) { | ||
//return a readable function! | ||
@@ -328,1 +327,2 @@ return function (end, cb) { | ||
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
63384