Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stream-from-array

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-from-array - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

62

index.js
'use strict';
var Readable = require('stream').Readable,
inherits = require('util').inherits;
var Readable = require('stream').Readable;
var inherits = require('util').inherits;
function StreamFromArray(array, options) {
if (!(this instanceof StreamFromArray)) {
return new StreamFromArray(array, options);
}
if (!(this instanceof StreamFromArray)) {
return new StreamFromArray(array, options);
}
Readable.call(this, options);
Readable.call(this, options);
this.__array = array;
this.__index = 0;
this.__array = array;
this.__index = 0;
}
inherits(StreamFromArray, Readable);
StreamFromArray.obj = function(array, options) {
options = options || {};
options.objectMode = true;
return new StreamFromArray(array, options);
StreamFromArray.obj = function (array, options) {
options = options || {};
options.objectMode = true;
return new StreamFromArray(array, options);
};
StreamFromArray.prototype._read = function() {
var needMoreData,
value;
while (this.__index < this.__array.length && needMoreData !== false) {
value = this.__array[this.__index++];
needMoreData = this.push(value);
if (typeof value === 'undefined' || value === null) {
// value signaled end of data
this.__index = this.__array.length;
} else if (this.__index === this.__array.length) {
// end of data
this.push(null);
}
}
StreamFromArray.prototype._read = function () {
var needMoreData;
var value;
if (this.__array.length === 0) {
// end of data
this.push(null);
return;
}
while (this.__index < this.__array.length && needMoreData !== false) {
value = this.__array[this.__index++];
needMoreData = this.push(value);
if (value === null) {
// value signaled end of data
this.__index = this.__array.length;
} else if (this.__index === this.__array.length) {
// end of data
this.push(null);
}
}
};
module.exports = StreamFromArray;
{
"name": "stream-from-array",
"version": "0.1.0",
"version": "1.0.0",
"description": "Create streams from arrays of arbitrary Javascript values like strings, functions, arrays, etc.",

@@ -25,19 +25,21 @@ "repository": {

"engines": {
"node": "^0.11 || ^0.10"
"node": ">=0.10.0"
},
"main": "index.js",
"files": [
"index.js"
],
"scripts": {
"test": "./node_modules/gulp/bin/gulp.js && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"
"test": "xo && nyc ava --verbose --timeout=10s"
},
"devDependencies": {
"coveralls": "^2.11.1",
"gulp": "^3.8.6",
"gulp-istanbul": "^0.2.0",
"gulp-jscs": "^0.6.0",
"gulp-jshint": "^1.7.1",
"gulp-mocha": "^0.5.0",
"merge-stream": "^0.1.5",
"stream-recorder": "^0.3.0",
"vinyl": "^0.2.3"
"ava": "^0.14.0",
"coveralls": "^2.11.6",
"gulp": "^3.9.1",
"merge-stream": "^1.0.0",
"nyc": "^6.4.4",
"stream-recorder": "^0.3.3",
"vinyl": "^1.1.1",
"xo": "^0.15.1"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc