concise-object-stream
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "concise-object-stream", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "More concise node object streams", | ||
"main": "index.js", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"precompile": "rm -f dist/*", | ||
"compile": "babel lib --out-dir dist", | ||
"coverage": "nyc --require babel-core/register --reporter=lcov mocha ./test && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", | ||
"lint": "standard", | ||
"test": "mocha", | ||
"watch": "chokidar '**/*.js' -c 'npm run lint && npm test'" | ||
"test": "nyc --check-coverage --require babel-core/register mocha ./test", | ||
"watch": "chokidar 'lib/*.js' 'test/*.js' -c 'npm run lint && npm test'", | ||
"ci": "npm run lint && npm test && npm run coverage", | ||
"prepublish": "npm run compile" | ||
}, | ||
@@ -20,10 +22,18 @@ "keywords": [ | ||
"devDependencies": { | ||
"babel-cli": "^6.7.7", | ||
"babel-core": "^6.7.7", | ||
"babel-plugin-transform-object-assign": "^6.5.0", | ||
"babel-preset-es2015": "^6.6.0", | ||
"babel-register": "^6.7.2", | ||
"chai": "^3.5.0", | ||
"chokidar-cli": "^1.2.0", | ||
"concat-stream": "^1.5.1", | ||
"coveralls": "^2.11.9", | ||
"lodash": "^4.8.2", | ||
"mocha": "^2.4.5", | ||
"nyc": "^6.4.0", | ||
"standard": "^6.0.8" | ||
}, | ||
"dependencies": { | ||
"promise": "^7.1.1", | ||
"readable-stream": "^2.0.6" | ||
@@ -30,0 +40,0 @@ }, |
@@ -5,2 +5,4 @@ # object-stream | ||
[![Build Status](https://travis-ci.org/toboid/concise-object-stream.svg?branch=master)](https://travis-ci.org/toboid/concise-object-stream) | ||
[![Coverage Status](https://coveralls.io/repos/github/toboid/concise-object-stream/badge.svg?branch=master)](https://coveralls.io/github/toboid/concise-object-stream?branch=master) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) | ||
@@ -10,7 +12,15 @@ | ||
## Getting started | ||
Install via NPM | ||
``` | ||
npm i concise-object-stream --save | ||
``` | ||
At it's simplest a transform stream can be created from function that returns the desired value to be queued or a promise for that value: | ||
``` javascript | ||
var objectStream = require('concise-object-stream') | ||
getKeyStream() | ||
.pipe(objectStream(key => getObject(key))) | ||
.pipe(objectStream.map(key => getObject(key))) | ||
.pipe(someOtherStream) | ||
@@ -22,3 +32,3 @@ ``` | ||
getKeyStream() | ||
.pipe(objectStream((key, callback) => { | ||
.pipe(objectStream.map((key, callback) => { | ||
const obj = getObject(key); | ||
@@ -33,3 +43,3 @@ callback(null, obj); | ||
getKeyStream() | ||
.pipe(objectStream(function (key, callback) { | ||
.pipe(objectStream.map(function (key, callback) { | ||
const obj = getObject(key); | ||
@@ -43,3 +53,3 @@ this.push(obj); | ||
## API | ||
`objectStream([options], [transform], [flush])` | ||
`objectStream.map([options], [transform], [flush])` | ||
### options | ||
@@ -49,3 +59,3 @@ Options to be passed to the `stream.Transform` constructor, see [here](https://nodejs.org/api/stream.html#stream_new_stream_transform_options) for available options. | ||
getKeyStream() | ||
.pipe(objectStream({highWaterMark: 6}, key => getObject(key))) | ||
.pipe(objectStream.map({highWaterMark: 6}, key => getObject(key))) | ||
.pipe(someOtherStream) | ||
@@ -60,3 +70,3 @@ ``` | ||
getKeyStream() | ||
.pipe(objectStream(function (key, callback) { | ||
.pipe(objectStream.map(function (key, callback) { | ||
const obj = getObject(key); | ||
@@ -72,3 +82,3 @@ this.push(obj); | ||
getKeyStream() | ||
.pipe(objectStream((key, callback) => { | ||
.pipe(objectStream.map((key, callback) => { | ||
const obj = getObject(key); | ||
@@ -83,3 +93,3 @@ callback(null, obj); | ||
getKeyStream() | ||
.pipe(objectStream(key => getObject(key))) | ||
.pipe(objectStream.map(key => getObject(key))) | ||
.pipe(someOtherStream) | ||
@@ -95,3 +105,3 @@ ``` | ||
getKeyStream() | ||
.pipe(objectStream(function (key, callback) { | ||
.pipe(objectStream.map(function (key, callback) { | ||
const obj = getObject(key); | ||
@@ -112,3 +122,3 @@ this.push(obj); | ||
getKeyStream() | ||
.pipe(objectStream((key, callback) => { | ||
.pipe(objectStream.map((key, callback) => { | ||
const obj = getObject(key); | ||
@@ -126,3 +136,3 @@ callback(null, obj); | ||
getKeyStream() | ||
.pipe(objectStream(key => getObject(key), () => getFinalObj())) | ||
.pipe(objectStream.map(key => getObject(key), () => getFinalObj())) | ||
.pipe(someOtherStream) | ||
@@ -129,0 +139,0 @@ ``` |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
62496
18
550
132
2
13
1
+ Addedpromise@^7.1.1
+ Addedasap@2.0.6(transitive)
+ Addedpromise@7.3.1(transitive)