Initial commit

master
Sven Slootweg 3 years ago
commit b8d2cc27ae

@ -0,0 +1,3 @@
{
"extends": "@joepie91/eslint-config"
}

1
.gitignore vendored

@ -0,0 +1 @@
node_modules

@ -0,0 +1,17 @@
"use strict";
const Promise = require("bluebird");
const pipe = require("@ppstreams/pipe");
const collect = require("@ppstreams/collect");
const fromIterable = require("@ppstreams/from-iterable");
const join = require("./");
Promise.try(() => {
return pipe([
fromIterable([ 1, 2, 3, 4, 5 ]),
join(0),
collect()
]).read();
}).then((values) => {
console.log(values); // [ 1, 0, 2, 0, 3, 0, 4, 0, 5 ]
});

@ -0,0 +1,21 @@
"use strict";
const pipe = require("@ppstreams/pipe");
const map = require("@ppstreams/map");
const buffer = require("@ppstreams/buffer");
module.exports = function join(joinValue) {
let firstValueProcessed = false;
return pipe([
map((value) => {
if (firstValueProcessed === false) {
firstValueProcessed = true;
return [ value ];
} else {
return [ joinValue, value ];
}
}),
buffer()
]);
};

@ -0,0 +1,20 @@
{
"name": "@ppstreams/join",
"version": "0.1.0",
"main": "index.js",
"keywords": [
"ppstreams"
],
"repository": "http://git.cryto.net/joepie91/join.git",
"author": "Sven Slootweg <admin@cryto.net>",
"license": "WTFPL OR CC0-1.0",
"devDependencies": {
"@joepie91/eslint-config": "^1.1.0",
"@ppstreams/collect": "^0.1.0",
"bluebird": "^3.7.2",
"eslint": "^6.8.0"
},
"dependencies": {
"@ppstreams/pipe": "^0.1.1"
}
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save